aboutsummaryrefslogtreecommitdiffstats
path: root/examples/declarative/window/doc/window.rst
diff options
context:
space:
mode:
authorAdrian Herrmann <adrian.herrmann@qt.io>2022-07-29 16:59:50 +0200
committerAdrian Herrmann <adrian.herrmann@qt.io>2022-09-05 12:45:35 +0000
commit9b8864f67412ecfad745111934f403318e6aab99 (patch)
tree44b502b5e794648d67e8dc09ec2ec3c1631f802a /examples/declarative/window/doc/window.rst
parent6c6a2f419f89c0894dc39d0223df7a0d6be9d44b (diff)
Add QML window example + shared QML module
Port the Qt Quick example "Window and Screen" to PySide. This includes a "shared" QML module located in a sibling directory of the example. Task-number: PYSIDE-841 Change-Id: I7c8376701390b10d8b28bbf0ad04dce7a3089b20 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io> Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io> (cherry picked from commit ef8d3daa8f4d19c48e44874dd6e38a3ed4d02425) Reviewed-by: Adrian Herrmann <adrian.herrmann@qt.io>
Diffstat (limited to 'examples/declarative/window/doc/window.rst')
-rw-r--r--examples/declarative/window/doc/window.rst35
1 files changed, 35 insertions, 0 deletions
diff --git a/examples/declarative/window/doc/window.rst b/examples/declarative/window/doc/window.rst
new file mode 100644
index 000000000..8736bb629
--- /dev/null
+++ b/examples/declarative/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.