diff options
Diffstat (limited to 'examples/qml/tutorials/extending-qml-advanced')
4 files changed, 11 insertions, 9 deletions
diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/doc/advanced2-Inheritance-and-coercion.rst b/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/doc/advanced2-Inheritance-and-coercion.rst index f5e989044..e55705d59 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/doc/advanced2-Inheritance-and-coercion.rst +++ b/examples/qml/tutorials/extending-qml-advanced/advanced2-Inheritance-and-coercion/doc/advanced2-Inheritance-and-coercion.rst @@ -23,7 +23,7 @@ To do this, the ``Boy`` and ``Girl`` classes are introduced, both inheriting fro The ``Person`` class remains unaltered and the ``Boy`` and ``Girl`` classes are trivial extensions of it. The types and their QML name are registered with the -QML engine with ``@QmlElement``. +QML engine with :deco:`~PySide6.QtQml.QmlElement`. Notice that the ``host`` and ``guests`` properties in ``BirthdayParty`` still take instances of ``Person``. @@ -47,8 +47,9 @@ explicit ``Boy`` or ``Girl`` should be instantiated instead. While we want to disallow instantiating ``Person`` from within QML, it still needs to be registered with the QML engine so that it can be used as a property -type and other types can be coerced to it. This is what the ``@QmlUncreatable`` -macro does. As all three types, ``Person``, ``Boy`` and ``Girl``, have been +type and other types can be coerced to it. This is what +:deco:`~PySide6.QtQml.QmlUncreatable` does. +As all three types, ``Person``, ``Boy`` and ``Girl``, have been registered with the QML system, on assignment, QML automatically (and type-safely) converts the ``Boy`` and ``Girl`` objects into a ``Person``. diff --git a/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/doc/advanced6-Property-value-source.rst b/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/doc/advanced6-Property-value-source.rst index 7b00b09bb..17e13d49f 100644 --- a/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/doc/advanced6-Property-value-source.rst +++ b/examples/qml/tutorials/extending-qml-advanced/advanced6-Property-value-source/doc/advanced6-Property-value-source.rst @@ -14,7 +14,7 @@ the song over time. :lines: 13-49 The class ``HappyBirthdaySong`` is added as a value source. It must inherit -from ``QQmlPropertyValueSource`` and implement its interface. The +from :class:`~PySide6.QtQml.QQmlPropertyValueSource` and implement its interface. The ``setTarget()`` function is used to define which property this source acts upon. In this case, the value source writes to the ``announcement`` property of the ``BirthdayParty`` to display the lyrics over time. It has an internal timer diff --git a/examples/qml/tutorials/extending-qml-advanced/extended/doc/extended.rst b/examples/qml/tutorials/extending-qml-advanced/extended/doc/extended.rst index 0df21716e..f901de9a2 100644 --- a/examples/qml/tutorials/extending-qml-advanced/extended/doc/extended.rst +++ b/examples/qml/tutorials/extending-qml-advanced/extended/doc/extended.rst @@ -3,12 +3,12 @@ Extending QML - Extension Objects Example This example builds on the the :ref:`example_qml_tutorials_extending-qml-advanced_adding`. -Shows how to use QmlExtended decorator to provide an extension object to a +Shows how to use :deco:`~PySide6.QtQml.QmlExtended` to provide an extension object to a QLineEdit without modifying or subclassing it. Firstly, the LineEditExtension class is registered with the QML system as an -extension of QLineEdit. We declare a foreign type to do this as we cannot -modify Qt's internal QLineEdit class. +extension of :class:`~PySide6.QtWidgets.QLineEdit`. We declare a foreign type to do +this as we cannot modify Qt's internal QLineEdit class. .. code-block:: python @@ -18,7 +18,8 @@ modify Qt's internal QLineEdit class. class LineEditForeign(QObject): -Note the usage of ``QmlNamedElement()`` instead of ``QmlElement()``. +Note the usage of :deco:`~PySide6.QtQml.QmlNamedElement` instead of +:deco:`~PySide6.QtQml.QmlElement`. ``QmlElement()`` uses the name of the containing type by default, ``LineEditExtension`` in this case. As the class being an extension class is an implementation detail, we choose the more natural name ``QLineEdit`` diff --git a/examples/qml/tutorials/extending-qml-advanced/methods/doc/methods.rst b/examples/qml/tutorials/extending-qml-advanced/methods/doc/methods.rst index 8f8bb5ae3..fe7469bd6 100644 --- a/examples/qml/tutorials/extending-qml-advanced/methods/doc/methods.rst +++ b/examples/qml/tutorials/extending-qml-advanced/methods/doc/methods.rst @@ -6,7 +6,7 @@ the :ref:`example_qml_tutorials_extending-qml-advanced_properties` and the :ref:`example_qml_tutorials_extending-qml-advanced_advanced2-inheritance-and-coercion`. The Methods Example has an additional method in the ``BirthdayParty`` class: -``invite()``. ``invite()`` is decorated with ``@Slot`` so that it can be +``invite()``. ``invite()`` is decorated with :deco:`~PySide6.QtCore.Slot` so that it can be called from QML. In ``example.qml``, the ``invite()`` method is called |
