aboutsummaryrefslogtreecommitdiffstats
path: root/examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/doc/advanced4-Grouped-properties.rst
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qml/tutorials/extending-qml-advanced/advanced4-Grouped-properties/doc/advanced4-Grouped-properties.rst')
-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