diff options
Diffstat (limited to 'sources/pyside6/doc/tutorials/qmlapp/qmlapplication.rst')
-rw-r--r-- | sources/pyside6/doc/tutorials/qmlapp/qmlapplication.rst | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/sources/pyside6/doc/tutorials/qmlapp/qmlapplication.rst b/sources/pyside6/doc/tutorials/qmlapp/qmlapplication.rst index 082490f4b..c6d72e742 100644 --- a/sources/pyside6/doc/tutorials/qmlapp/qmlapplication.rst +++ b/sources/pyside6/doc/tutorials/qmlapp/qmlapplication.rst @@ -9,21 +9,21 @@ QtQml and QtQuick modules provides the necessary infrastructure for QML-based UIs. In this tutorial, you'll also learn how to provide data from Python -as a QML context property, which is then consumed by the ListView +as a QML initial property, which is then consumed by the ListView defined in the QML file. Before you begin, install the following prerequisites: * The `PySide6 <https://pypi.org/project/PySide6/>`_ Python packages. -* Qt Creator v4.9 beta1 or later from - `http://download.qt.io - <http://download.qt.io/snapshots/qtcreator/4.9/4.9.0-beta1/>`_. +* *Qt Creator* from + `https://download.qt.io + <https://download.qt.io/snapshots/qtcreator/>`_. The following step-by-step instructions guide you through application -development process using Qt Creator: +development process using *Qt Creator*: -#. Open Qt Creator and select **File > New File or Project..** menu item +#. Open *Qt Creator* and select **File > New File or Project..** menu item to open following dialog: .. image:: newpyproject.png @@ -61,8 +61,8 @@ development process using Qt Creator: .. literalinclude:: main.py :linenos: - :lines: 40-60 - :emphasize-lines: 12-20 + :lines: 3-23 + :emphasize-lines: 7-9,14-17 #. Now, set up the application window using :ref:`PySide6.QtGui.QGuiApplication<qguiapplication>`, which manages the application-wide @@ -70,7 +70,7 @@ development process using Qt Creator: .. literalinclude:: main.py :linenos: - :lines: 40-65 + :lines: 3-28 :emphasize-lines: 23-25 .. note:: Setting the resize policy is important if you want the @@ -78,28 +78,28 @@ development process using Qt Creator: Otherwise, the root item will retain its original size on resizing the window. -#. You can now expose the ``data_list`` variable as a QML context +#. You can now expose the ``data_list`` variable as a QML initial property, which will be consumed by the QML ListView item in ``view.qml``. .. literalinclude:: main.py :linenos: - :lines: 40-70 - :emphasize-lines: 27-30 + :lines: 3-33 + :emphasize-lines: 28-31 #. Load the ``view.qml`` to the ``QQuickView`` and call ``show()`` to display the application window. .. literalinclude:: main.py :linenos: - :lines: 40-79 - :emphasize-lines: 33-39 + :lines: 3-42 + :emphasize-lines: 33-40 #. Finally, execute the application to start the event loop and clean up. .. literalinclude:: main.py :linenos: - :lines: 40- - :emphasize-lines: 41-43 + :lines: 3- + :emphasize-lines: 42-44 #. Your application is ready to be run now. Select **Projects** mode to choose the Python version to run it. |