diff options
Diffstat (limited to 'examples/quick/window/window.qml')
-rw-r--r-- | examples/quick/window/window.qml | 46 |
1 files changed, 27 insertions, 19 deletions
diff --git a/examples/quick/window/window.qml b/examples/quick/window/window.qml index 47cc5257b..99ff4403e 100644 --- a/examples/quick/window/window.qml +++ b/examples/quick/window/window.qml @@ -7,12 +7,11 @@ import QtQuick.Controls QtObject { id: root property real defaultSpacing: 10 - property SystemPalette palette: SystemPalette { } property var controlWindow: Window { width: col.implicitWidth + root.defaultSpacing * 2 height: col.implicitHeight + root.defaultSpacing * 2 - color: root.palette.window + color: palette.window title: "Control Window" Column { id: col @@ -90,13 +89,13 @@ QtObject { " and has visibility " + parent.visibilityToString(root.testWindow.visibility) } Rectangle { - color: root.palette.text + color: palette.text width: parent.width height: 1 } CurrentScreen { } Rectangle { - color: root.palette.text + color: palette.text width: parent.width height: 1 } @@ -117,35 +116,44 @@ QtObject { anchors.centerIn: parent text: "Second Window" } - MouseArea { - anchors.fill: parent - onClicked: root.testWindow.color = "#e0c31e" + TapHandler { + onTapped: root.testWindow.color = Qt.rgba(0.25 + Math.random() / 2, + 0.65 + Math.random() / 4, + 0.15 + Math.random() / 3) } Button { - anchors.right: parent.right - anchors.top: parent.top - anchors.margins: root.defaultSpacing - text: root.testWindow.visibility === Window.FullScreen ? "exit fullscreen" : "go fullscreen" - width: 150 - onClicked: { - if (root.testWindow.visibility === Window.FullScreen) - root.testWindow.visibility = Window.AutomaticVisibility - else - root.testWindow.visibility = Window.FullScreen + id: fullscreenButton + anchors { + right: parent.right + top: parent.top + margins: root.defaultSpacing } + width: height + checkable: true + Binding on checked { value: root.testWindow.visibility === Window.FullScreen } + onClicked: root.testWindow.visibility = checked ? Window.FullScreen : Window.AutomaticVisibility + text: "âļ" + ToolTip.visible: hovered + ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval + ToolTip.text: root.testWindow.visibility === Window.FullScreen ? qsTr("restore") : qsTr("fill screen") } Button { anchors.left: parent.left anchors.top: parent.top anchors.margins: root.defaultSpacing - text: "X" - width: 30 + text: "â" + width: height + height: fullscreenButton.height onClicked: root.testWindow.close() + ToolTip.visible: hovered + ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval + ToolTip.text: qsTr("close this window") } } } property var splashWindow: Splash { + visible: true onTimeout: root.controlWindow.visible = true } } |