summaryrefslogtreecommitdiffstats
path: root/qml/DemoHeader.qml
diff options
context:
space:
mode:
authorSamuli Piippo <samuli.piippo@qt.io>2019-08-02 15:35:03 +0300
committerSamuli Piippo <samuli.piippo@qt.io>2019-08-02 15:35:03 +0300
commit61e0c9da397573d8ca3c4f7994f73864ba822aac (patch)
treec89261ce7f6499cfeb60ba2e924abbb71cc3838e /qml/DemoHeader.qml
parent04cecef50d9316d98c11e8b82be5a492ef9bde70 (diff)
parentf89cf3ae354de42df46588d50a3ad0816cc8fc28 (diff)
Merge remote-tracking branch 'origin/5.12' into 5.135.13
* origin/5.12: Use applicationsRoot path from settings file instead of hard-coding Remove hard-coded values for default video and default location Make demo header as overlay on top of loader and add auto-hide timer Change-Id: Ie82098dcb0db6595fd27ba2231d73034c29d0874
Diffstat (limited to 'qml/DemoHeader.qml')
-rw-r--r--qml/DemoHeader.qml29
1 files changed, 26 insertions, 3 deletions
diff --git a/qml/DemoHeader.qml b/qml/DemoHeader.qml
index 555fff2..0ee83bc 100644
--- a/qml/DemoHeader.qml
+++ b/qml/DemoHeader.qml
@@ -111,11 +111,13 @@ Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
y: open ? parent.height - height/2 : parent.height
rotation: open ? 180 : 0
+ Drag.active: headerToggleMouseArea.drag.active
Behavior on rotation { NumberAnimation { duration: 100 } }
Behavior on y { NumberAnimation { duration: 100 } }
MouseArea {
+ id: headerToggleMouseArea
anchors.fill: parent
anchors.margins: -parent.height * 0.5
drag.target: demoHeaderBar
@@ -123,13 +125,34 @@ Rectangle {
drag.minimumX: -demoHeaderBar.height
drag.maximumY: 0
+ DropArea {
+ anchors.fill: parent
+ onDropped: demoHeaderVisibilityDelay.restart()
+ }
+
onClicked: {
- if (demoHeaderBar.y < -demoHeaderBar.height / 2)
+ if (demoHeaderBar.y < -demoHeaderBar.height / 2) {
demoHeaderBar.y = 0
- else
+ demoHeaderVisibilityDelay.restart()
+ } else {
demoHeaderBar.y = -demoHeaderBar.height
+ }
+ }
+ onReleased: {
+ demoHeaderBar.y = demoHeaderBar.y > -demoHeaderBar.height / 4 ? 0 : -demoHeaderBar.height
+ parent.Drag.drop()
}
- onReleased: demoHeaderBar.y = demoHeaderBar.y > -demoHeaderBar.height / 4 ? 0 : -demoHeaderBar.height
+ }
+ }
+
+ Component.onCompleted: demoHeaderVisibilityDelay.start()
+
+ Timer {
+ id: demoHeaderVisibilityDelay
+ interval: viewSettings.headerAutoHideDelay
+ onTriggered: {
+ if (!demoHeaderVisibilityDelay.running)
+ demoHeaderBar.y = -demoHeaderBar.height
}
}
}