mirror of
https://github.com/jaredtao/TaoQuick.git
synced 2025-01-19 20:22:56 +08:00
Frameless 窗口 可能导致黑边,暂时屏蔽边框
This commit is contained in:
parent
7e73057397
commit
c91c2a171a
@ -111,7 +111,7 @@ TaoFrameLessView::TaoFrameLessView(QWindow *parent) : QQuickView(parent), d(new
|
|||||||
setFlags(Qt::CustomizeWindowHint | Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
setFlags(Qt::CustomizeWindowHint | Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint | Qt::WindowTitleHint | Qt::WindowSystemMenuHint);
|
||||||
setResizeMode(SizeRootObjectToView);
|
setResizeMode(SizeRootObjectToView);
|
||||||
|
|
||||||
d->setBorderLess((HWND)(winId()), d->borderless);
|
// d->setBorderLess((HWND)(winId()), d->borderless);
|
||||||
d->setBorderLessShadow((HWND)(winId()), d->borderless_shadow);
|
d->setBorderLessShadow((HWND)(winId()), d->borderless_shadow);
|
||||||
|
|
||||||
setIsMax(isMaxWin(this));
|
setIsMax(isMaxWin(this));
|
||||||
|
@ -4,9 +4,9 @@ import QtQuick.Controls 2.2
|
|||||||
MouseArea {
|
MouseArea {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
hoverEnabled: true
|
hoverEnabled: true
|
||||||
propagateComposedEvents: true
|
// propagateComposedEvents: true
|
||||||
//鼠标图标, hovered 或者 pressed时显示此图标
|
//鼠标图标, hovered 或者 pressed时显示此图标
|
||||||
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ForbiddenCursor
|
cursorShape: Qt.PointingHandCursor
|
||||||
onDoubleClicked: { mouse.accepted = false;}
|
onDoubleClicked: { mouse.accepted = false;}
|
||||||
onPositionChanged: { mouse.accepted = false;}
|
onPositionChanged: { mouse.accepted = false;}
|
||||||
onPressed: { mouse.accepted = false; }
|
onPressed: { mouse.accepted = false; }
|
||||||
|
@ -19,11 +19,12 @@ Item {
|
|||||||
property var widthList
|
property var widthList
|
||||||
property var xList
|
property var xList
|
||||||
property real totalW
|
property real totalW
|
||||||
|
property real visualWidth
|
||||||
|
|
||||||
onWidthListChanged: {
|
onWidthListChanged: {
|
||||||
updateXList()
|
updateXList()
|
||||||
}
|
}
|
||||||
onWidthChanged: {
|
onVisualWidthChanged: {
|
||||||
updateWidthList()
|
updateWidthList()
|
||||||
updateXList()
|
updateXList()
|
||||||
}
|
}
|
||||||
@ -39,6 +40,10 @@ Item {
|
|||||||
tw += widthList[i]
|
tw += widthList[i]
|
||||||
}
|
}
|
||||||
xList = xL
|
xList = xL
|
||||||
|
if (tw < visualWidth) {
|
||||||
|
widthList[widthList.length - 1] += visualWidth - tw
|
||||||
|
tw = visualWidth
|
||||||
|
}
|
||||||
totalW = tw
|
totalW = tw
|
||||||
}
|
}
|
||||||
property var updateWidthList: function () {}
|
property var updateWidthList: function () {}
|
||||||
@ -123,13 +128,11 @@ Item {
|
|||||||
}
|
}
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: headerArea
|
id: headerArea
|
||||||
hoverEnabled: true
|
enabled: needSort
|
||||||
|
hoverEnabled: enabled
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
fill: parent
|
||||||
leftMargin: 2
|
leftMargin: 4
|
||||||
right: parent.right
|
|
||||||
top: parent.top
|
|
||||||
bottom: parent.bottom
|
|
||||||
}
|
}
|
||||||
onClicked: {
|
onClicked: {
|
||||||
if (dataObj.sortRole !== headerRoles[index]) {
|
if (dataObj.sortRole !== headerRoles[index]) {
|
||||||
@ -146,11 +149,9 @@ Item {
|
|||||||
}
|
}
|
||||||
MoveArea {
|
MoveArea {
|
||||||
id: moveArea
|
id: moveArea
|
||||||
width: 2
|
width: 4
|
||||||
height: parent.height
|
height: parent.height
|
||||||
enabled: index > 0
|
enabled: index > 0
|
||||||
hoverEnabled: true
|
|
||||||
z: 9
|
|
||||||
anchors {
|
anchors {
|
||||||
left: parent.left
|
left: parent.left
|
||||||
}
|
}
|
||||||
@ -163,19 +164,37 @@ Item {
|
|||||||
}
|
}
|
||||||
cursorShape: (pressed || containsMouse) ? Qt.SplitHCursor : Qt.ArrowCursor
|
cursorShape: (pressed || containsMouse) ? Qt.SplitHCursor : Qt.ArrowCursor
|
||||||
onMove: {
|
onMove: {
|
||||||
var wList = widthList
|
|
||||||
if (index === 0) {
|
if (index === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if (CusTableConstant.minWidth <= wList[index] + xOffset && wList[index] + xOffset <= CusTableConstant.maxWidth ) {
|
var wList = widthList
|
||||||
|
// if (index === widthList.length - 2) {
|
||||||
|
// if (validWidth(wList[index] + xOffset) && validWidth(wList[index + 1] - xOffset)) {
|
||||||
|
// isOut = false
|
||||||
|
// wList[index] += xOffset
|
||||||
|
// wList[index + 1] -= xOffset
|
||||||
|
// widthList = wList
|
||||||
|
// } else {
|
||||||
|
// isOut = true
|
||||||
|
// }
|
||||||
|
|
||||||
|
// } else {
|
||||||
|
if (validWidth(wList[index] + xOffset) ) {
|
||||||
isOut = false
|
isOut = false
|
||||||
wList[index] += xOffset
|
wList[index] += xOffset
|
||||||
widthList = wList
|
widthList = wList
|
||||||
} else {
|
} else {
|
||||||
isOut = true
|
isOut = true
|
||||||
}
|
}
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function validWidth(targetWidth) {
|
||||||
|
return inRange(targetWidth,CusTableConstant.minWidth,CusTableConstant.maxWidth )
|
||||||
|
}
|
||||||
|
function inRange(value, min, max) {
|
||||||
|
return (min <= value && value <= max)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,6 +60,7 @@ Rectangle {
|
|||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
font.pixelSize: CusConfig.fontSize_tableContent
|
||||||
color: textColor
|
color: textColor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user