mirror of
https://github.com/lubosz/overte.git
synced 2025-04-13 18:52:13 +02:00
Enable resizable dialogs
This commit is contained in:
parent
16efa2a46f
commit
8d23bf874f
1 changed files with 32 additions and 2 deletions
|
@ -15,6 +15,10 @@ Item {
|
|||
property int animationDuration: 400
|
||||
property bool destroyOnInvisible: false
|
||||
property bool destroyOnCloseButton: true
|
||||
property bool resizable: false
|
||||
property int minX: 256
|
||||
property int minY: 256
|
||||
clip: true
|
||||
|
||||
onEnabledChanged: {
|
||||
scale = enabled ? 1.0 : 0.0
|
||||
|
@ -37,6 +41,11 @@ Item {
|
|||
}
|
||||
enabled = false;
|
||||
}
|
||||
|
||||
function deltaSize(dx, dy) {
|
||||
width = Math.max(width + dx, minX)
|
||||
height = Math.max(height + dy, minY)
|
||||
}
|
||||
|
||||
Behavior on scale {
|
||||
NumberAnimation {
|
||||
|
@ -82,8 +91,6 @@ Item {
|
|||
|
||||
MouseArea {
|
||||
id: titleDrag
|
||||
property int startX
|
||||
property int startY
|
||||
anchors.right: closeButton.left
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
|
@ -127,6 +134,29 @@ Item {
|
|||
anchors.rightMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
clip: true
|
||||
} // client border
|
||||
} // window border
|
||||
|
||||
MouseArea {
|
||||
id: sizeDrag
|
||||
property int startX
|
||||
property int startY
|
||||
anchors.right: parent.right
|
||||
anchors.bottom: parent.bottom
|
||||
width: 16
|
||||
height: 16
|
||||
hoverEnabled: true
|
||||
onPressed: {
|
||||
startX = mouseX
|
||||
startY = mouseY
|
||||
}
|
||||
onPositionChanged: {
|
||||
if (pressed && dialog.resizable) {
|
||||
dialog.deltaSize((mouseX - startX), (mouseY - startY))
|
||||
startX = mouseX
|
||||
startY = mouseY
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue