mirror of
https://github.com/overte-org/overte.git
synced 2025-07-24 01:03:58 +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 int animationDuration: 400
|
||||||
property bool destroyOnInvisible: false
|
property bool destroyOnInvisible: false
|
||||||
property bool destroyOnCloseButton: true
|
property bool destroyOnCloseButton: true
|
||||||
|
property bool resizable: false
|
||||||
|
property int minX: 256
|
||||||
|
property int minY: 256
|
||||||
|
clip: true
|
||||||
|
|
||||||
onEnabledChanged: {
|
onEnabledChanged: {
|
||||||
scale = enabled ? 1.0 : 0.0
|
scale = enabled ? 1.0 : 0.0
|
||||||
|
@ -38,6 +42,11 @@ Item {
|
||||||
enabled = false;
|
enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function deltaSize(dx, dy) {
|
||||||
|
width = Math.max(width + dx, minX)
|
||||||
|
height = Math.max(height + dy, minY)
|
||||||
|
}
|
||||||
|
|
||||||
Behavior on scale {
|
Behavior on scale {
|
||||||
NumberAnimation {
|
NumberAnimation {
|
||||||
//This specifies how long the animation takes
|
//This specifies how long the animation takes
|
||||||
|
@ -82,8 +91,6 @@ Item {
|
||||||
|
|
||||||
MouseArea {
|
MouseArea {
|
||||||
id: titleDrag
|
id: titleDrag
|
||||||
property int startX
|
|
||||||
property int startY
|
|
||||||
anchors.right: closeButton.left
|
anchors.right: closeButton.left
|
||||||
anchors.bottom: parent.bottom
|
anchors.bottom: parent.bottom
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
@ -127,6 +134,29 @@ Item {
|
||||||
anchors.rightMargin: 0
|
anchors.rightMargin: 0
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
anchors.leftMargin: 0
|
anchors.leftMargin: 0
|
||||||
|
clip: true
|
||||||
} // client border
|
} // client border
|
||||||
} // window 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