diff options
-rw-r--r-- | qml/DemoHeader.qml | 29 | ||||
-rw-r--r-- | qml/MainWindow.qml | 6 | ||||
-rw-r--r-- | qml/ViewSettings.qml | 1 |
3 files changed, 28 insertions, 8 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 } } } diff --git a/qml/MainWindow.qml b/qml/MainWindow.qml index d957468..c1f4e54 100644 --- a/qml/MainWindow.qml +++ b/qml/MainWindow.qml @@ -180,11 +180,7 @@ Item { objectName: "applicationLoader" opacity: 0; visible: opacity > 0.1 - height: root.demoHeaderEnabled ? parent.height - (demoHeader.height + demoHeader.y) : parent.height - - anchors.top: root.demoHeaderEnabled ? demoHeader.bottom : root.top - anchors.left: parent.left - anchors.right: parent.right + anchors.fill: parent asynchronous: true; onStatusChanged: { diff --git a/qml/ViewSettings.qml b/qml/ViewSettings.qml index 3798e68..82f4241 100644 --- a/qml/ViewSettings.qml +++ b/qml/ViewSettings.qml @@ -37,6 +37,7 @@ Item { property real demoHeaderHeight: 2.5 * pageMargin property string appFont: "TitilliumWeb" property int stateDelay: 200; + property int headerAutoHideDelay: 3000 property string backgroundColor: "#09102b" property string borderColor: "#9d9faa" property string buttonGreenColor: "#41cd52" |