diff options
Diffstat (limited to 'qml/DemoHeader.qml')
-rw-r--r-- | qml/DemoHeader.qml | 29 |
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 } } } |