diff options
Diffstat (limited to 'examples/quick/window')
-rw-r--r-- | examples/quick/window/AllScreens.qml | 42 | ||||
-rw-r--r-- | examples/quick/window/CurrentScreen.qml | 83 | ||||
-rw-r--r-- | examples/quick/window/Splash.qml | 42 | ||||
-rw-r--r-- | examples/quick/window/doc/window.png | bin | 0 -> 9863 bytes | |||
-rw-r--r-- | examples/quick/window/doc/window.rst | 35 | ||||
-rw-r--r-- | examples/quick/window/main.py | 40 | ||||
-rw-r--r-- | examples/quick/window/rc_window.py | 335 | ||||
-rw-r--r-- | examples/quick/window/resources/icon.icns | bin | 0 -> 59662 bytes | |||
-rw-r--r-- | examples/quick/window/resources/icon.ico | bin | 0 -> 11825 bytes | |||
-rw-r--r-- | examples/quick/window/resources/icon.svg | 208 | ||||
-rw-r--r-- | examples/quick/window/resources/icon64.png | bin | 0 -> 3004 bytes | |||
-rw-r--r-- | examples/quick/window/window.pyproject | 3 | ||||
-rw-r--r-- | examples/quick/window/window.qml | 151 | ||||
-rw-r--r-- | examples/quick/window/window.qrc | 8 |
14 files changed, 947 insertions, 0 deletions
diff --git a/examples/quick/window/AllScreens.qml b/examples/quick/window/AllScreens.qml new file mode 100644 index 000000000..25438f21a --- /dev/null +++ b/examples/quick/window/AllScreens.qml @@ -0,0 +1,42 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +Column { + id: root + spacing: 8 + + Label { + text: "Total number of screens: " + screenInfo.count + font.bold: true + } + + Flow { + spacing: 12 + width: parent.width + + Repeater { + id: screenInfo + model: (Qt.application as Application).screens + Label { + required property string name + required property int virtualX + required property int virtualY + required property var modelData // avoid shadowing Label.width and height + + lineHeight: 1.5 + text: name + "\n" + virtualX + ", " + virtualY + " " + modelData.width + "x" + modelData.height + } + } + } + + Component.onCompleted: { + var screens = (Qt.application as Application).screens; + for (var i = 0; i < screens.length; ++i) + console.log("screen " + screens[i].name + " has geometry " + + screens[i].virtualX + ", " + screens[i].virtualY + " " + + screens[i].width + "x" + screens[i].height) + } +} diff --git a/examples/quick/window/CurrentScreen.qml b/examples/quick/window/CurrentScreen.qml new file mode 100644 index 000000000..1f4da7f0b --- /dev/null +++ b/examples/quick/window/CurrentScreen.qml @@ -0,0 +1,83 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +Item { + id: root + width: 400 + height: propertyGrid.implicitHeight + 16 + + function orientationToString(o) { + switch (o) { + case Qt.PrimaryOrientation: + return "primary"; + case Qt.PortraitOrientation: + return "portrait"; + case Qt.LandscapeOrientation: + return "landscape"; + case Qt.InvertedPortraitOrientation: + return "inverted portrait"; + case Qt.InvertedLandscapeOrientation: + return "inverted landscape"; + } + return "unknown"; + } + + Grid { + id: propertyGrid + columns: 2 + spacing: 8 + x: spacing + y: spacing + + //! [screen] + Label { + text: "Screen \"" + Screen.name + "\":" + font.bold: true + } + Item { width: 1; height: 1 } // spacer + + Label { text: "manufacturer" } + Label { text: Screen.manufacturer ? Screen.manufacturer : "unknown" } + + Label { text: "model" } + Label { text: Screen.model ? Screen.model : "unknown" } + + Label { text: "serial number" } + Label { text: Screen.serialNumber ? Screen.serialNumber : "unknown" } + + Label { text: "dimensions" } + Label { text: Screen.width + "x" + Screen.height } + + Label { text: "pixel density" } + Label { text: Screen.pixelDensity.toFixed(2) + " dots/mm (" + (Screen.pixelDensity * 25.4).toFixed(2) + " dots/inch)" } + + Label { text: "logical pixel density" } + Label { text: Screen.logicalPixelDensity.toFixed(2) + " dots/mm (" + (Screen.logicalPixelDensity * 25.4).toFixed(2) + " dots/inch)" } + + Label { text: "device pixel ratio" } + Label { text: Screen.devicePixelRatio.toFixed(2) } + + Label { text: "available virtual desktop" } + Label { text: Screen.desktopAvailableWidth + "x" + Screen.desktopAvailableHeight } + + Label { text: "position in virtual desktop" } + Label { text: Screen.virtualX + ", " + Screen.virtualY } + + Label { text: "orientation" } + Label { text: root.orientationToString(Screen.orientation) + " (" + Screen.orientation + ")" } + + Label { text: "primary orientation" } + Label { text: root.orientationToString(Screen.primaryOrientation) + " (" + Screen.primaryOrientation + ")" } + //! [screen] + + Label { text: "10mm rectangle" } + Rectangle { + color: "red" + width: Screen.pixelDensity * 10 + height: width + } + } +} diff --git a/examples/quick/window/Splash.qml b/examples/quick/window/Splash.qml new file mode 100644 index 000000000..0a7da219d --- /dev/null +++ b/examples/quick/window/Splash.qml @@ -0,0 +1,42 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import shared + +//! [splash-properties] +Window { + id: splash + color: "transparent" + title: "Splash Window" + modality: Qt.ApplicationModal + flags: Qt.SplashScreen + property int timeoutInterval: 2000 + signal timeout +//! [splash-properties] +//! [screen-properties] + x: (Screen.width - splashImage.width) / 2 + y: (Screen.height - splashImage.height) / 2 +//! [screen-properties] + width: splashImage.width + height: splashImage.height + + Image { + id: splashImage + source: Images.qtLogo + MouseArea { + anchors.fill: parent + onClicked: Qt.quit() + } + } + //! [timer] + Timer { + interval: splash.timeoutInterval; running: true; repeat: false + onTriggered: { + splash.visible = false + splash.timeout() + } + } + //! [timer] + Component.onCompleted: visible = true +} diff --git a/examples/quick/window/doc/window.png b/examples/quick/window/doc/window.png Binary files differnew file mode 100644 index 000000000..72487b4d9 --- /dev/null +++ b/examples/quick/window/doc/window.png diff --git a/examples/quick/window/doc/window.rst b/examples/quick/window/doc/window.rst new file mode 100644 index 000000000..6a8f73eed --- /dev/null +++ b/examples/quick/window/doc/window.rst @@ -0,0 +1,35 @@ +Qt Quick Examples - Window and Screen +===================================== + +This example demonstrates the Window and Screen types in QML. + +.. image:: window.png + :width: 392 + :alt: Window and Screen screenshot + +In addition, this example demonstrates the usage of the Qt Resource System in +Qt for Python for more advanced scenarios. There are several QML files, one of +which imports a module from this sibling directory. Both this "shared" module +and the QML files of the example need to be compiled into Python modules with +the resource compiler rcc. + +For the "shared" module approach to work with QML and rcc, you need: + +* A module definition *qmldir* file +* A Qt Resource Collection file (.qrc) specifying all the QML files and other + resources, plus the *qmldir* file + +The .qrc file is the input to rcc. This will generate a Python module (called +*shared_rc* here) that can then be imported from the Python code. At runtime, +only this Python module is needed, not the .qrc file or any of the .qml files +or even the image resources, as they have all been compiled into the Python +module. + +For the example, rcc needs: + +* A Qt Resource Collection file (.qrc) specifying all the QML files and other + resources. There is no qmldir file here because this is not a module. + +This will generate a Python module (called *window_rc* here) that can then be +imported from the Python code. Again, only the Python module is needed at +runtime. diff --git a/examples/quick/window/main.py b/examples/quick/window/main.py new file mode 100644 index 000000000..62ba6a5e9 --- /dev/null +++ b/examples/quick/window/main.py @@ -0,0 +1,40 @@ +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import os +from pathlib import Path +import sys + +from PySide6.QtCore import QUrl, qWarning +from PySide6.QtGui import QGuiApplication +from PySide6.QtQml import QQmlComponent, QQmlEngine +from PySide6.QtQuick import QQuickWindow +from PySide6.QtQuickControls2 import QQuickStyle + +import rc_window # noqa: F401 + +# Append the parent directory of this file so that Python can find and +# import from the "shared" sibling directory. +sys.path.append(os.fspath(Path(__file__).parent.parent)) +from shared import shared_rc # noqa: F401, E402 + + +if __name__ == "__main__": + app = QGuiApplication(sys.argv) + if sys.platform == "win32": + QQuickStyle.setStyle("Fusion") + engine = QQmlEngine() + + # Add the qrc root as QML import path so that the "shared" module + # can be found. + engine.addImportPath(":/") + + component = QQmlComponent(engine) + QQuickWindow.setDefaultAlphaBuffer(True) + component.loadUrl(QUrl("qrc:///window/window.qml")) + if component.isReady(): + component.create() + else: + qWarning(component.errorString()) + app.exit(1) + app.exec() diff --git a/examples/quick/window/rc_window.py b/examples/quick/window/rc_window.py new file mode 100644 index 000000000..30b1fbf0a --- /dev/null +++ b/examples/quick/window/rc_window.py @@ -0,0 +1,335 @@ +# Resource object code (Python 3) +# Created by: object code +# Created by: The Resource Compiler for Qt version 6.5.0 +# WARNING! All changes made in this file will be lost! + +from PySide6 import QtCore + +qt_resource_data = b"\ +\x00\x00\x05\x12\ +/\ +/ Copyright (C) \ +2021 The Qt Comp\ +any Ltd.\x0d\x0a// SPD\ +X-License-Identi\ +fier: LicenseRef\ +-Qt-Commercial O\ +R BSD-3-Clause\x0d\x0a\ +\x0d\x0aimport QtQuick\ +\x0d\x0aimport QtQuick\ +.Controls\x0d\x0a\x0d\x0aCol\ +umn {\x0d\x0a id: r\ +oot\x0d\x0a spacing\ +: 8\x0d\x0a\x0d\x0a Label\ + {\x0d\x0a text\ +: \x22Total number \ +of screens: \x22 + \ +screenInfo.count\ +\x0d\x0a font.b\ +old: true\x0d\x0a }\ +\x0d\x0a\x0d\x0a Flow {\x0d\x0a\ + spacing:\ + 12\x0d\x0a wid\ +th: parent.width\ +\x0d\x0a\x0d\x0a Repe\ +ater {\x0d\x0a \ + id: screenIn\ +fo\x0d\x0a \ +model: (Qt.appli\ +cation as Applic\ +ation).screens\x0d\x0a\ + Labe\ +l {\x0d\x0a \ + required pr\ +operty string na\ +me\x0d\x0a \ + required pro\ +perty int virtua\ +lX\x0d\x0a \ + required pro\ +perty int virtua\ +lY\x0d\x0a \ + required pro\ +perty var modelD\ +ata // avoid sha\ +dowing Label.wid\ +th and height\x0d\x0a\x0d\ +\x0a \ + lineHeight: 1.5\ +\x0d\x0a \ + text: name + \x22\ +\x5cn\x22 + virtualX +\ + \x22, \x22 + virtualY\ + + \x22 \x22 + modelDa\ +ta.width + \x22x\x22 +\ + modelData.heigh\ +t\x0d\x0a }\ +\x0d\x0a }\x0d\x0a \ + }\x0d\x0a\x0d\x0a Compon\ +ent.onCompleted:\ + {\x0d\x0a var \ +screens = (Qt.ap\ +plication as App\ +lication).screen\ +s;\x0d\x0a for \ +(var i = 0; i < \ +screens.length; \ +++i)\x0d\x0a \ + console.log(\x22s\ +creen \x22 + screen\ +s[i].name + \x22 ha\ +s geometry \x22 +\x0d\x0a\ + \ + screens[\ +i].virtualX + \x22,\ + \x22 + screens[i].\ +virtualY + \x22 \x22 +\ +\x0d\x0a \ + screen\ +s[i].width + \x22x\x22\ + + screens[i].he\ +ight)\x0d\x0a }\x0d\x0a}\x0d\ +\x0a\ +\x00\x00\x04\x8a\ +\x00\ +\x00\x16\xa7x\xda\xcdXYo\xdbF\x10~7\xe0\xff\ +0a_\xec\x06\xba\x93\x17\x15Fa+H\x1d\xc0A\ +b\xcb\xa8\x03\x14}\xa0\xc9\x91\xb8\xf5\x8a+\xec.-\ +9\xae\xff{\x87\xc7\x92\x94\xb8$\xe5ZnJ\x08\x10\ +\xb9;;\xc77\x07g\xd8\xeb\xc1D,\x1f$\x9b\x07\ +\x1a\x8e&\xc70\xec\x0f\x07p\x1d \x5cj\xdaY,\ +\xdd\xf0\x01.\xb4\xdf=<\xe8\xf5`\xfa\xf5\xc3\xb7\xce\ +\x05\xf30T\xd8\xf9\xe4c\xa8\xd9\x8c\xa1\x1cC\xb6v\ +\x85\xb3\xce\xa5\xee\xd0\xb9\x05J\x8f\xb9\x1c\xbe\x5c\xc1\xd9\ +\xf4Cg\xd4\x99p7Rxxpx\xc0\x16K!\ +5\xf1\xbf\x8c\x98w\xb7\xfd\xdc\x9d\x88PK\xc1UL\ +z\xa9\xbf\xdc\xfe\x85\x9e\x86\xc7\xc3\x03\xa0\x8b\xf9c\x90\ +B\xe8\xf4i)\xc5\x12\xa5~\x00\x89$\xc9\xc7\x99\x1b\ +q=]\xba\x1e\x0b\xe7c\x18\xf4\xb7\xa8\xa6\x0fJ\xe3\ +\xe2\xab\xcbQk\x84e\xfa?\xdeZ~\x84\xa7X\xf0\ +\xc6\xc1{W\x82\x97ju\xc3B_\xac\xc6\x90\xfe\x1b\ +\xb5\xe2k\xc5|\x1d\x8c\x89\x8ew\xc9 \xce<\xa6o\ +\xe2%x\x9bh\xdc\xddT\x0f~\x86aq6\xc0\x18\ +\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x22\x85\xa74r7\x09\xae\xb7\xb2\xe5\x95\x9b\xba\ +\xe4\x84\xdc\x88}o4\xc0f]\xea\x9bX\xa3\x88L\ +#%\x0bLioH\x0c\xb1\x16\xcb\x9c\x94\xee\xeb\x09\ +wwQ\xcb\x88\xdc4\x16P\x09\xc55\xd3Pz\x85\ +\xc5\xa5t.\xca+\xb5)>x\xdfo\x04\xbe\xae\xf1\ +\x9f\xc1\xd1s5=\xae+\xe8\xb0\xbf>>\xbe\x90+\ +|\x99\xa8g\xccH\xcf\x8e4\x8e\xb3\x22\xd0\xe2\x87\x1f\ +\x14g\xce\xb7\xfa\xa0\x18\xf5\x9f\x97\x8c\x5c(<\xaa\x7f\ +\x936\x96u\xb5\xe4\xae\x0aLa\x9f&Oe\xfcD\ +x\xcd\x16(\x22\x93\x1a\x1b\x9fUK\x9f}\xb4\x8c0\ +\x97C\xbf\x7f\x00\xe8k\x05\xe6\ +\x00\x00\x04$\ +/\ +/ Copyright (C) \ +2021 The Qt Comp\ +any Ltd.\x0d\x0a// SPD\ +X-License-Identi\ +fier: LicenseRef\ +-Qt-Commercial O\ +R BSD-3-Clause\x0d\x0a\ +\x0d\x0aimport QtQuick\ +\x0d\x0aimport shared\x0d\ +\x0a\x0d\x0a//! [splash-p\ +roperties]\x0d\x0aWind\ +ow {\x0d\x0a id: sp\ +lash\x0d\x0a color:\ + \x22transparent\x22\x0d\x0a\ + title: \x22Spla\ +sh Window\x22\x0d\x0a \ +modality: Qt.App\ +licationModal\x0d\x0a \ + flags: Qt.Spl\ +ashScreen\x0d\x0a p\ +roperty int time\ +outInterval: 200\ +0\x0d\x0a signal ti\ +meout\x0d\x0a//! [spla\ +sh-properties]\x0d\x0a\ +//! [screen-prop\ +erties]\x0d\x0a x: \ +(Screen.width - \ +splashImage.widt\ +h) / 2\x0d\x0a y: (\ +Screen.height - \ +splashImage.heig\ +ht) / 2\x0d\x0a//! [sc\ +reen-properties]\ +\x0d\x0a width: spl\ +ashImage.width\x0d\x0a\ + height: spla\ +shImage.height\x0d\x0a\ +\x0d\x0a Image {\x0d\x0a \ + id: splas\ +hImage\x0d\x0a \ +source: Images.q\ +tLogo\x0d\x0a M\ +ouseArea {\x0d\x0a \ + anchors.\ +fill: parent\x0d\x0a \ + onClic\ +ked: Qt.quit()\x0d\x0a\ + }\x0d\x0a }\ +\x0d\x0a //! [timer\ +]\x0d\x0a Timer {\x0d\x0a\ + interval\ +: splash.timeout\ +Interval; runnin\ +g: true; repeat:\ + false\x0d\x0a \ +onTriggered: {\x0d\x0a\ + spla\ +sh.visible = fal\ +se\x0d\x0a \ +splash.timeout()\ +\x0d\x0a }\x0d\x0a \ + }\x0d\x0a //! [tim\ +er]\x0d\x0a Compone\ +nt.onCompleted: \ +visible = true\x0d\x0a\ +}\x0d\x0a\ +\x00\x00\x03\x08\ +\x00\ +\x00\x0a\xb7x\xda\xadV\xdfo\xda0\x10~G\xe2\x7f\ +\xb8\xe5\x09\xb6\x91\x00\xeb\xa6)}\x986\xaam\x95\xd0\ +\xdaB\xa5uZ\xf7`\x92\x03\xac&v\xe48\x144\ +\xf5\x7f\x9f\x9d\x1f\x8d\x01\x0f\x82\xb6\x08\x89\xdc\xf9\xbb\xfb\ +>\xdbg_<\x0fF<\xd9\x08\xbaXJ\xe8\x8c\xba\ +0\xec\x0f\x07p\xbbD\xb8\x91j$N\x08\xdb\xc0X\ +\x86n\xbb\xe5y0\xbd\xbe\xb8\xeb\x8di\x80,\xc5\xde\ +e\x88L\xd29E\xe1C\xe9\x9b\xe0\xbcw#{*\ +.F\x11P\x12\xc1\xd5\x04>M/zoz\xa3\x88\ +d)\xb6[\xed\x16\x8d\x13.\xa4\xca\x7f\x93\xd1\xe0a\ +\xd7vG\x9cI\xc1\xa3TC/%\xc6\xf0\xbb\xdd\x02\ +\xf5\xd0\xd0\x07\xc1\xb9,\xacG\x1a\xca\xa5\x0fg\xfd~\ +a/Q\xcf\xc0\x87D\xf0\x04\x85\xdc|\x114tU\ +\xe6\x88\x06T~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\xb5\ +\x06R\x16,\xbb\x87\xd7#\xe2\x0b\x1a\xa8\xad8Qs\ +\x19v}\xaatK\xdc\xbf\xce \xc4\x95j\x85\xe5\x04\ +\x84\xbe\xdc\x8e\xcb/br\x15\x13\x1dar\x1f\xe2\x22\ ++B#2\x8b\x10VT\xc8\x8c\xe8\x15K\x1f$O\ +\x9aP\xe6\xc0\x8fU\x86\xef\xb6\xe2\xda\x05}mPl\ +\x5c-\xa2n\xab\x94\x9d.\xaa\x0c\xb8\xd3:^\x83!\ +\xa4\x1c\xf8q\x90\xdah\xe4\x07\xa8\xf4\x17\x84k\xeb\xf9\ +%\x951Tl|\xc7\xd0a\x0c\xea\xb1#\xa5P6\ +|\xf8?\xc2\x92\xbd\xef\x8c}}\xfb\x98Z\xa6\xbd\x1d\ +\xfdU\xfc\xa0\xaf\x0e\x8b\xc0@\x12\xb6\x88p+\xc3\xa4\ +\xf2\xee\xb6/\xd5;\xb9\xfa\x16t\x04\x86;=\xaal\ +<\xf6\x1bc\xd0\xdf\x06W\xbd)\x0f\xdakg\xeaO\ +\xfd\xfe\x00\x1e\x91\x1e\xa9\ +" + +qt_resource_name = b"\ +\x00\x06\ +\x07\xe0Kg\ +\x00w\ +\x00i\x00n\x00d\x00o\x00w\ +\x00\x0e\ +\x0ei\x17\x5c\ +\x00A\ +\x00l\x00l\x00S\x00c\x00r\x00e\x00e\x00n\x00s\x00.\x00q\x00m\x00l\ +\x00\x0a\ +\x0bi\x98\xbc\ +\x00w\ +\x00i\x00n\x00d\x00o\x00w\x00.\x00q\x00m\x00l\ +\x00\x0a\ +\x08\x90\x1a|\ +\x00S\ +\x00p\x00l\x00a\x00s\x00h\x00.\x00q\x00m\x00l\ +\x00\x11\ +\x02YG\x1c\ +\x00C\ +\x00u\x00r\x00r\x00e\x00n\x00t\x00S\x00c\x00r\x00e\x00e\x00n\x00.\x00q\x00m\x00l\ +\ +" + +qt_resource_struct = b"\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\ +\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00\x00\x00\x02\x00\x00\x00\x04\x00\x00\x00\x02\ +\x00\x00\x00\x00\x00\x00\x00\x00\ +\x00\x00\x00h\x00\x01\x00\x00\x00\x01\x00\x00\x0d\xcc\ +\x00\x00\x01\x87V\x12\x92R\ +\x00\x00\x00N\x00\x00\x00\x00\x00\x01\x00\x00\x09\xa4\ +\x00\x00\x01\x87V\x12\x92R\ +\x00\x00\x004\x00\x01\x00\x00\x00\x01\x00\x00\x05\x16\ +\x00\x00\x01\x87V\x12\x92R\ +\x00\x00\x00\x12\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\ +\x00\x00\x01\x87V\x12\x92R\ +" + +def qInitResources(): + QtCore.qRegisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data) + +def qCleanupResources(): + QtCore.qUnregisterResourceData(0x03, qt_resource_struct, qt_resource_name, qt_resource_data) + +qInitResources() diff --git a/examples/quick/window/resources/icon.icns b/examples/quick/window/resources/icon.icns Binary files differnew file mode 100644 index 000000000..88b4b2444 --- /dev/null +++ b/examples/quick/window/resources/icon.icns diff --git a/examples/quick/window/resources/icon.ico b/examples/quick/window/resources/icon.ico Binary files differnew file mode 100644 index 000000000..52af30a6c --- /dev/null +++ b/examples/quick/window/resources/icon.ico diff --git a/examples/quick/window/resources/icon.svg b/examples/quick/window/resources/icon.svg new file mode 100644 index 000000000..0b6153206 --- /dev/null +++ b/examples/quick/window/resources/icon.svg @@ -0,0 +1,208 @@ +<?xml version="1.0" encoding="UTF-8" standalone="no"?> +<!-- Created with Inkscape (http://www.inkscape.org/) --> + +<svg + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:cc="http://creativecommons.org/ns#" + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" + xmlns:svg="http://www.w3.org/2000/svg" + xmlns="http://www.w3.org/2000/svg" + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" + width="128" + height="128" + id="svg2" + sodipodi:version="0.32" + inkscape:version="0.48.2 r9819" + version="1.0" + sodipodi:docname="icon.svg" + inkscape:export-filename="/Users/rutledge/dev/qt5-stable/qtdeclarative/examples/quick/window/window/icon80.png" + inkscape:export-xdpi="61.509998" + inkscape:export-ydpi="61.509998" + inkscape:output_extension="org.inkscape.output.svg.inkscape"> + <defs + id="defs4"> + <linearGradient + id="linearGradient4009"> + <stop + style="stop-color:#ffffff;stop-opacity:1;" + offset="0" + id="stop4011" /> + <stop + id="stop4019" + offset="0.875" + style="stop-color:#ffffff;stop-opacity:0.49803922;" /> + <stop + style="stop-color:#ffffff;stop-opacity:0;" + offset="1" + id="stop4013" /> + </linearGradient> + <inkscape:perspective + sodipodi:type="inkscape:persp3d" + inkscape:vp_x="0 : 186.64798 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_z="559.62469 : 186.64798 : 1" + inkscape:persp3d-origin="279.81235 : 124.43199 : 1" + id="perspective4876" /> + <inkscape:perspective + id="perspective2836" + inkscape:persp3d-origin="22 : 14.666667 : 1" + inkscape:vp_z="44 : 22 : 1" + inkscape:vp_y="0 : 1000 : 0" + inkscape:vp_x="0 : 22 : 1" + sodipodi:type="inkscape:persp3d" /> + <filter + inkscape:collect="always" + id="filter4063" + x="-0.195491" + width="1.390982" + y="-0.16235915" + height="1.3247183"> + <feGaussianBlur + inkscape:collect="always" + stdDeviation="3.3077485" + id="feGaussianBlur4065" /> + </filter> + </defs> + <sodipodi:namedview + id="base" + pagecolor="#ffffff" + bordercolor="#666666" + borderopacity="1.0" + gridtolerance="10" + guidetolerance="10" + objecttolerance="10000" + inkscape:pageopacity="0.0" + inkscape:pageshadow="2" + inkscape:zoom="2.9775825" + inkscape:cx="62.656189" + inkscape:cy="42.423381" + inkscape:document-units="px" + inkscape:current-layer="layer1" + inkscape:window-width="1280" + inkscape:window-height="744" + inkscape:window-x="2003" + inkscape:window-y="156" + showgrid="true" + borderlayer="true" + showguides="true" + inkscape:guide-bbox="true" + inkscape:snap-global="false" + inkscape:window-maximized="0"> + <inkscape:grid + type="xygrid" + id="grid7194" + visible="true" + enabled="true" + spacingx="8px" + spacingy="8px" /> + </sodipodi:namedview> + <metadata + id="metadata7"> + <rdf:RDF> + <cc:Work + rdf:about=""> + <dc:format>image/svg+xml</dc:format> + <dc:type + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> + <dc:title></dc:title> + </cc:Work> + </rdf:RDF> + </metadata> + <g + inkscape:label="Layer 1" + inkscape:groupmode="layer" + id="layer1" + transform="translate(-66.38047,-391.3222)"> + <path + id="path7304" + d="M 95.556318,434.65407 L 165.25811,434.65407 L 165.25811,490.10429 L 95.556318,490.10429 L 95.556318,434.65407 z" + style="fill:#01afaf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141000000000;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" /> + <path + style="fill:#a7c706;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" + d="m 96.869177,465.30846 c 27.677903,3.04574 41.155393,12.11589 48.000003,24 l -48.000003,0 0,-24 z" + id="path7300" + sodipodi:nodetypes="cccc" + inkscape:connector-curvature="0" /> + <path + sodipodi:nodetypes="cccc" + id="path7302" + d="M 165.46767,465.22201 C 137.78977,468.26775 124.31228,477.33791 117.46767,489.22201 L 165.46767,489.22201 L 165.46767,465.22201 z" + style="fill:#966406;fill-rule:evenodd;stroke:#000000;stroke-width:3;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none;fill-opacity:1" /> + <path + style="fill:#80ffff;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141000000000;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;opacity:1;fill-opacity:1" + d="M 95.532809,434.35736 L 74.567964,420.38079 L 74.567964,497.25189 L 95.532809,490.26361 L 95.532809,434.35736 z" + id="path7270" + sodipodi:nodetypes="ccccc" /> + <path + style="fill:#00ffff;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" + d="M 74.567964,455.3222 L 95.532809,462.31048" + id="path7272" + sodipodi:nodetypes="cc" /> + <g + style="fill:#80ffff;fill-opacity:1" + id="g7278" + transform="matrix(-0.8735352,0,0,0.8735352,244.36615,64.570513)"> + <path + style="fill:#80ffff;fill-rule:evenodd;stroke:#000000;stroke-width:6;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1" + d="M 24,32 L 0,16 L 0,104 L 24,96 L 24,32 z" + id="path7280" + transform="translate(66.38047,391.3222)" /> + <path + style="fill:#80ffff;fill-rule:evenodd;stroke:#000000;stroke-width:6;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1;fill-opacity:1" + d="M 0,56 L 24,64" + id="path7282" + transform="translate(66.38047,391.3222)" + sodipodi:nodetypes="cc" /> + </g> + <path + style="fill:#ffffff;fill-opacity:1;filter:url(#filter4063)" + d="m 119.74679,437.94232 c -0.0487,0.003 -0.0932,0.0315 -0.14149,0.0354 -0.1659,0.0132 -0.33372,0.008 -0.49523,0.0354 -0.96156,0.0643 -1.9037,0.14607 -2.86523,0.21224 -2.94807,0.23566 -5.19987,2.66253 -5.19987,6.01345 l 0,39.51194 3.32508,3.07747 0,-0.0354 33.2155,-5.58898 c 2.28673,-0.39587 4.06792,-3.06727 4.06792,-5.97808 l 0,-32.18967 -30.5625,-5.023 c -0.45263,-0.0748 -0.91269,-0.0942 -1.34418,-0.0708 z" + id="path3987" + inkscape:connector-curvature="0" /> + <g + id="g3" + transform="matrix(0.20572087,0,0,0.20572087,113.4162,440.80626)"> + <path + sodipodi:nodetypes="cccccccc" + id="path5" + style="fill:#006225" + d="M 43.09,0.3586 C 40.94,0.0036 38.84,-0.0824 36.81,0.0776 31.968136,0.39505671 27.122677,0.73638425 22.28,1.0696 9.62,2.0816 0,12.4996 0,26.8896 l 0,169.7 14.19,13.2 28.87,-209.42 0.03,-0.011 z" + inkscape:connector-curvature="0" /> + <path + id="path7" + style="fill:#80c342" + d="m 174.4,160 c 0,12.5 -7.75,24.07 -17.57,25.77 L 14.23,209.73 V 25.93 C 14.23,9.21 27.57,-2.27 43.12,0.3 l 131.3,21.52 v 138.2 z" + inkscape:connector-curvature="0" /> + <path + id="path11" + style="fill:#006225" + d="m 154.9,80.96 -12.96,-0.598 0,0.278 6.945,0.32 6.016,0 z" + inkscape:connector-curvature="0" /> + <path + id="path13" + style="fill:#006225" + d="m 144.6,135.6 c 0.66,0.328 1.43,0.476 2.351,0.476 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 h -6.015 c -1.821,0.832 -3.532,1.457 -5.176,1.848 z" + inkscape:connector-curvature="0" /> + <path + d="m 91.15,132.4 c 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -4.34,0 -7.68,2.535 -10.01,7.625 -2.52,5.543 -3.793,17.04 -3.793,34.44 0,16.82 1.238,28.75 3.734,35.75 2.356,6.672 5.879,9.976 10.5,9.976 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 m 17.98,3.75 c -4.117,9.707 -10.39,16.06 -18.99,19 0.867,4.449 2.176,7.441 3.922,9.019 1.351,1.211 3.433,1.821 6.222,1.821 0.805,0 1.668,-0.055 2.59,-0.157 v 13.12 l -5.961,0.782 c -1.758,0.23 -3.426,0.343 -5.004,0.343 -5.218,0 -9.445,-1.265 -12.62,-3.824 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 1.629,0 3.309,0.102 5.043,0.305 11.95,1.375 20.62,7.016 26.26,16.79 5.535,9.562 8.254,23.27 8.254,41.26 0,16.48 -2,29.45 -6.043,39.02 z M 130.4,45.91 l 11.52,1.238 0,20.21 12.96,0.914 0,12.68 -12.96,-0.598 0,46.33 c 0,4.032 0.445,6.625 1.34,7.789 0.8,1.067 2.046,1.594 3.71,1.594 0.161,0 0.329,-0.004 0.497,-0.016 2.55,-0.148 5.32,-0.933 8.343,-2.308 v 11.65 c -5.136,2.258 -10.18,3.598 -15.12,4.02 -0.718,0.055 -1.41,0.086 -2.078,0.086 -4.48,0 -7.906,-1.301 -10.25,-3.934 -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.535 L 118.046,79.25 V 65.66 l 7.586,0.547 4.773,-20.3 z" + style="fill:#ffffff" + id="path17" + inkscape:connector-curvature="0" /> + <path + id="path19" + style="fill:#006225" + d="m 100.3,166 c 0.809,0 1.672,-0.055 2.59,-0.157 H 98.054 C 98.73,165.949 99.507,166 100.3,166 z" + inkscape:connector-curvature="0" /> + <path + d="m 84.85,63.98 c 2.336,5.997 3.484,16.92 3.484,32.81 0,17.7 -1.16,29.57 -3.512,35.62 -1.894,4.879 -4.527,7.902 -7.863,9.07 0.965,0.368 1.992,0.551 3.078,0.551 0.207,0 0.41,-0.008 0.621,-0.019 4.633,-0.293 8.121,-3.496 10.49,-9.602 2.351,-6.051 3.511,-17.91 3.511,-35.62 0,-15.89 -1.148,-26.82 -3.484,-32.81 -2.336,-6.027 -5.832,-9.281 -10.52,-9.691 -0.359,-0.031 -0.714,-0.051 -1.058,-0.051 -1.09,0 -2.117,0.16 -3.082,0.481 h -0.004 c 3.601,1.121 6.379,4.215 8.336,9.261 z m -2.344,114.3 c -0.113,-0.05 -0.227,-0.105 -0.336,-0.16 -0.012,-0.004 -0.023,-0.012 -0.035,-0.015 -0.102,-0.051 -0.207,-0.106 -0.309,-0.157 -0.019,-0.011 -0.039,-0.019 -0.058,-0.031 -0.09,-0.051 -0.184,-0.098 -0.278,-0.148 -0.027,-0.016 -0.054,-0.036 -0.086,-0.051 -0.082,-0.043 -0.164,-0.09 -0.242,-0.137 -0.039,-0.023 -0.078,-0.047 -0.113,-0.07 -0.07,-0.039 -0.145,-0.082 -0.215,-0.125 -0.047,-0.031 -0.094,-0.059 -0.14,-0.09 -0.059,-0.039 -0.118,-0.074 -0.176,-0.113 -0.059,-0.039 -0.114,-0.075 -0.168,-0.114 -0.051,-0.031 -0.102,-0.066 -0.149,-0.097 -0.066,-0.047 -0.132,-0.094 -0.195,-0.137 -0.039,-0.027 -0.078,-0.055 -0.113,-0.082 -0.078,-0.055 -0.153,-0.113 -0.231,-0.172 -0.023,-0.016 -0.05,-0.035 -0.078,-0.055 -0.098,-0.078 -0.199,-0.156 -0.297,-0.234 -4.207,-3.379 -7.308,-9.894 -9.297,-19.54 -9.136,-1.945 -16.26,-7.754 -21.19,-17.5 -5.004,-9.902 -7.551,-24.39 -7.551,-43.34 0,-20.43 3.484,-35.51 10.34,-45.07 5.789,-8.07 13.86,-12.04 24.02,-12.04 h -6.351 c -10.15,0.008 -18.22,3.977 -24,12.04 -6.855,9.563 -10.34,24.64 -10.34,45.07 0,18.95 2.547,33.44 7.551,43.34 4.934,9.75 12.05,15.56 21.19,17.5 1.989,9.641 5.09,16.16 9.297,19.54 3.176,2.559 7.403,3.824 12.62,3.824 0.098,0 0.199,0 0.297,-0.004 h 5.539 c -3.406,-0.05 -6.383,-0.66 -8.906,-1.828 L 82.498,178.28 z M 128.4,145.6 c -2.73,-3.051 -4.09,-7.949 -4.09,-14.67 V 79.57 l -6.226,-0.285 v -13.59 h -6.016 v 3.035 c 0.871,3.273 1.555,6.82 2.063,10.64 l 4.164,0.192 v 51.36 c 0,6.723 1.367,11.62 4.09,14.67 2.343,2.633 5.765,3.934 10.25,3.934 h 6.015 c -4.48,0 -7.906,-1.301 -10.25,-3.934 z m 2.043,-99.66 -6.016,0 -4.668,19.88 5.911,0.422 4.773,-20.3 z" + style="fill:#006225" + id="path21" + inkscape:connector-curvature="0" /> + </g> + <path + style="fill:none;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:5.24121141;stroke-linecap:round;stroke-linejoin:round;marker:none;marker-start:none;marker-mid:none;marker-end:none;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;visibility:visible;display:inline;overflow:visible;enable-background:accumulate" + d="M 96.506224,434.65407 L 166.20801,434.65407 L 166.20801,490.10429 L 96.506224,490.10429 L 96.506224,434.65407 z" + id="rect7265" /> + </g> +</svg> diff --git a/examples/quick/window/resources/icon64.png b/examples/quick/window/resources/icon64.png Binary files differnew file mode 100644 index 000000000..0fa324401 --- /dev/null +++ b/examples/quick/window/resources/icon64.png diff --git a/examples/quick/window/window.pyproject b/examples/quick/window/window.pyproject new file mode 100644 index 000000000..d3375e95b --- /dev/null +++ b/examples/quick/window/window.pyproject @@ -0,0 +1,3 @@ +{ + "files": ["main.py", "window.qml", "window.qrc", "Splash.qml", "AllScreens.qml", "CurrentScreen.qml"] +} diff --git a/examples/quick/window/window.qml b/examples/quick/window/window.qml new file mode 100644 index 000000000..47cc5257b --- /dev/null +++ b/examples/quick/window/window.qml @@ -0,0 +1,151 @@ +// Copyright (C) 2021 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +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 + title: "Control Window" + Column { + id: col + anchors.fill: parent + anchors.margins: root.defaultSpacing + spacing: root.defaultSpacing + property real cellWidth: col.width / 3 - spacing + Label { text: "Control the second window:" } + Grid { + id: grid + columns: 3 + spacing: root.defaultSpacing + width: parent.width + Button { + id: showButton + width: col.cellWidth + text: root.testWindow.visible ? "Hide" : "Show" + onClicked: root.testWindow.visible = !root.testWindow.visible + } + //! [windowedCheckbox] + CheckBox { + text: "Windowed" + height: showButton.height + width: col.cellWidth + Binding on checked { value: root.testWindow.visibility === Window.Windowed } + onClicked: root.testWindow.visibility = Window.Windowed + } + //! [windowedCheckbox] + CheckBox { + height: showButton.height + width: col.cellWidth + text: "Full Screen" + Binding on checked { value: root.testWindow.visibility === Window.FullScreen } + onClicked: root.testWindow.visibility = Window.FullScreen + } + Button { + id: autoButton + width: col.cellWidth + text: "Automatic" + onClicked: root.testWindow.visibility = Window.AutomaticVisibility + } + CheckBox { + height: autoButton.height + text: "Minimized" + Binding on checked { value: root.testWindow.visibility === Window.Minimized } + onClicked: root.testWindow.visibility = Window.Minimized + } + CheckBox { + height: autoButton.height + text: "Maximized" + Binding on checked { value: root.testWindow.visibility === Window.Maximized } + onClicked: root.testWindow.visibility = Window.Maximized + } + } + function visibilityToString(v) { + switch (v) { + case Window.Windowed: + return "windowed"; + case Window.Minimized: + return "minimized"; + case Window.Maximized: + return "maximized"; + case Window.FullScreen: + return "fullscreen"; + case Window.AutomaticVisibility: + return "automatic"; + case Window.Hidden: + return "hidden"; + } + return "unknown"; + } + Label { + id: visibilityLabel + text: "second window is " + (root.testWindow.visible ? "visible" : "invisible") + + " and has visibility " + parent.visibilityToString(root.testWindow.visibility) + } + Rectangle { + color: root.palette.text + width: parent.width + height: 1 + } + CurrentScreen { } + Rectangle { + color: root.palette.text + width: parent.width + height: 1 + } + AllScreens { width: parent.width } + } + } + + property var testWindow: Window { + width: 320 + height: 240 + color: "#215400" + title: "Test Window with color " + color + flags: Qt.Window | Qt.WindowFullscreenButtonHint + Rectangle { + anchors.fill: parent + anchors.margins: root.defaultSpacing + Label { + anchors.centerIn: parent + text: "Second Window" + } + MouseArea { + anchors.fill: parent + onClicked: root.testWindow.color = "#e0c31e" + } + 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 + } + } + Button { + anchors.left: parent.left + anchors.top: parent.top + anchors.margins: root.defaultSpacing + text: "X" + width: 30 + onClicked: root.testWindow.close() + } + } + } + + property var splashWindow: Splash { + onTimeout: root.controlWindow.visible = true + } +} diff --git a/examples/quick/window/window.qrc b/examples/quick/window/window.qrc new file mode 100644 index 000000000..89d1de1b1 --- /dev/null +++ b/examples/quick/window/window.qrc @@ -0,0 +1,8 @@ +<RCC> + <qresource prefix="/window"> + <file>window.qml</file> + <file>Splash.qml</file> + <file>CurrentScreen.qml</file> + <file>AllScreens.qml</file> + </qresource> +</RCC> |