qtquick: Remove unneeded mouse area from frame

Just to simplify things. Let's just have the resize handlers.
A target can have many event sources.
This commit is contained in:
Sergio Martins
2021-03-03 13:22:12 +00:00
parent f174ab6ebc
commit 54f17cb546
3 changed files with 125 additions and 105 deletions

View File

@@ -16,15 +16,21 @@ import QtQuick.Layouts 1.9
MouseArea {
id: root
property int resizeMargin: 2
property int shape
property bool resizeAllowed: true
required property int resizeMargin
required property int shape
required property bool resizeAllowed
required property QtObject frameCpp
hoverEnabled: true
width: resizeMargin
cursorShape: enabled ? shape : Qt.ArrowCursor // Even if disabled the MouseArea changes cursor, as it's different than Item.enabled, so explicitly change cursor if disabled
z: mouseArea.z + 1
enabled: resizeAllowed
onPressed: { mouse.accepted = false; }
onReleased: { mouse.accepted = false; }
onFrameCppChanged: {
if (frameCpp) {
// When Frame is in MDI mode, we need to detect when the mouse over the edges
frameCpp.redirectMouseEvents(this)
}
}
}