1
0
mirror of https://github.com/jaredtao/TaoQuick.git synced 2025-01-17 20:12:54 +08:00

Frameless 窗口 可能导致黑边,暂时屏蔽边框

This commit is contained in:
jared 2021-06-07 14:15:55 +08:00
parent 7e73057397
commit c91c2a171a
4 changed files with 35 additions and 15 deletions

View File

@ -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);
setResizeMode(SizeRootObjectToView);
d->setBorderLess((HWND)(winId()), d->borderless);
// d->setBorderLess((HWND)(winId()), d->borderless);
d->setBorderLessShadow((HWND)(winId()), d->borderless_shadow);
setIsMax(isMaxWin(this));

View File

@ -4,9 +4,9 @@ import QtQuick.Controls 2.2
MouseArea {
anchors.fill: parent
hoverEnabled: true
propagateComposedEvents: true
// propagateComposedEvents: true
// hovered pressed
cursorShape: enabled ? Qt.PointingHandCursor : Qt.ForbiddenCursor
cursorShape: Qt.PointingHandCursor
onDoubleClicked: { mouse.accepted = false;}
onPositionChanged: { mouse.accepted = false;}
onPressed: { mouse.accepted = false; }

View File

@ -19,11 +19,12 @@ Item {
property var widthList
property var xList
property real totalW
property real visualWidth
onWidthListChanged: {
updateXList()
}
onWidthChanged: {
onVisualWidthChanged: {
updateWidthList()
updateXList()
}
@ -39,6 +40,10 @@ Item {
tw += widthList[i]
}
xList = xL
if (tw < visualWidth) {
widthList[widthList.length - 1] += visualWidth - tw
tw = visualWidth
}
totalW = tw
}
property var updateWidthList: function () {}
@ -123,13 +128,11 @@ Item {
}
MouseArea {
id: headerArea
hoverEnabled: true
enabled: needSort
hoverEnabled: enabled
anchors {
left: parent.left
leftMargin: 2
right: parent.right
top: parent.top
bottom: parent.bottom
fill: parent
leftMargin: 4
}
onClicked: {
if (dataObj.sortRole !== headerRoles[index]) {
@ -146,11 +149,9 @@ Item {
}
MoveArea {
id: moveArea
width: 2
width: 4
height: parent.height
enabled: index > 0
hoverEnabled: true
z: 9
anchors {
left: parent.left
}
@ -163,19 +164,37 @@ Item {
}
cursorShape: (pressed || containsMouse) ? Qt.SplitHCursor : Qt.ArrowCursor
onMove: {
var wList = widthList
if (index === 0) {
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
wList[index] += xOffset
widthList = wList
} else {
isOut = true
}
// }
}
}
}
}
function validWidth(targetWidth) {
return inRange(targetWidth,CusTableConstant.minWidth,CusTableConstant.maxWidth )
}
function inRange(value, min, max) {
return (min <= value && value <= max)
}
}

View File

@ -60,6 +60,7 @@ Rectangle {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
font.pixelSize: CusConfig.fontSize_tableContent
color: textColor
}
}