aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2023-05-03 14:52:06 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2023-05-10 21:29:59 +0200
commit7c5721fe74183e37bac46b42929c35c293f1ad54 (patch)
tree2ec34232eecce69bfb8e8d228286076708529d0c /examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties
parent3e40f27cb539e0106511790a40327f5a03e48fab (diff)
QML reference examples: Adapt tutorial texts
Take over the texts from C++ with adaptions for Python. Task-number: PYSIDE-2206 Task-number: QTBUG-111033 Pick-to: 6.5 Change-Id: I0e4f1ec39b10bc1440389219604194b2ee001450 Reviewed-by: Cristian Maureira-Fredes <cristian.maureira-fredes@qt.io>
Diffstat (limited to 'examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties')
-rw-r--r--examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/doc/advanced4-Grouped-properties.rst46
1 files changed, 34 insertions, 12 deletions
diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/doc/advanced4-Grouped-properties.rst b/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/doc/advanced4-Grouped-properties.rst
index 691c1d393..7748d3189 100644
--- a/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/doc/advanced4-Grouped-properties.rst
+++ b/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/doc/advanced4-Grouped-properties.rst
@@ -1,17 +1,39 @@
-.. _qml-grouped-example:
+.. _qml-advanced-advanced4-grouped-properties:
-Extending QML - Grouped Properties Example
-==========================================
+Extending QML (advanced) - Grouped Properties
+=============================================
-Grouped Properties.
+This is the fourth of a series of 6 examples forming a tutorial using the
+example of a birthday party to demonstrate some of the advanced features of
+QML.
-This example builds on the the :ref:`qml-default-property-example`,
-the :ref:`qml-inheritance-and-coercion-example`
-the :ref:`qml-object-and-list-property-types-example`
-and the :ref:`qml-adding-types-example`.
+More information is needed about the shoes of the guests. Aside from their
+size, we also want to store the shoes' color, brand, and price. This
+information is stored in a ``ShoeDescription`` class.
-Running the Example
--------------------
+.. literalinclude:: person.py
+ :lineno-start: 14
+ :lines: 14-66
-The ``main.py`` file in the example includes a simple shell application that
-loads and runs the QML snippet shown below.
+Each person now has two properties, a ``name`` and a shoe description ``shoe``.
+
+.. literalinclude:: person.py
+ :lineno-start: 69
+ :lines: 69-90
+
+Specifying the values for each element of the shoe description works but is a
+bit repetitive.
+
+.. literalinclude:: People/Main.qml
+ :lineno-start: 26
+ :lines: 26-32
+
+Grouped properties provide a more elegant way of assigning these properties.
+Instead of assigning the values to each property one-by-one, the individual
+values can be passed as a group to the ``shoe`` property making the code more
+readable. No changes are required to enable this feature as it is available by
+default for all of QML.
+
+.. literalinclude:: People/Main.qml
+ :lineno-start: 9
+ :lines: 9-12