diff options
author | Friedemann Kleint <[email protected]> | 2024-10-23 09:04:59 +0200 |
---|---|---|
committer | Friedemann Kleint <[email protected]> | 2024-10-24 09:44:57 +0200 |
commit | 0f1756769b66152c561233bb2de1ce3e21a8321f (patch) | |
tree | e4934e2af44bb0a90cc3ba43808abdf39618d96b /sources/pyside6/doc | |
parent | 35eb8b218405cec8610394add763d1d4297ae24a (diff) |
Fix extra class documentation
- Add indentation
- Use refs for classes and decorators
- Fix method/parameter listings
Pick-to: 6.8
Change-Id: Iaada9d40e734935d5e56d75fc2a9b1a72da58e33
Reviewed-by: Cristian Maureira-Fredes <[email protected]>
Reviewed-by: Shyamnath Premnadh <[email protected]>
Diffstat (limited to 'sources/pyside6/doc')
19 files changed, 392 insertions, 394 deletions
diff --git a/sources/pyside6/doc/extras/QtCore.ClassInfo.rst b/sources/pyside6/doc/extras/QtCore.ClassInfo.rst index 75445e1fc..969e7cd2d 100644 --- a/sources/pyside6/doc/extras/QtCore.ClassInfo.rst +++ b/sources/pyside6/doc/extras/QtCore.ClassInfo.rst @@ -1,34 +1,33 @@ .. currentmodule:: PySide6.QtCore .. py:decorator:: ClassInfo -This decorator is used to associate extra information to the class, which is available -using ``QObject.metaObject()``. This information is used by the -*Qt D-Bus* and *Qt Qml* modules. + This decorator is used to associate extra information to the class, which is available + using :meth:`QObject.metaObject`. This information is used by the + *Qt D-Bus* and *Qt Qml* modules. -The extra information takes the form of a dictionary with key and value in a literal string. + The extra information takes the form of a dictionary with key and value in a literal string. -The recommended usage is to provide the key/value using python keyword syntax, where the -keyword becomes the key, and the provided string becomes the value. + The recommended usage is to provide the key/value using python keyword syntax, where the + keyword becomes the key, and the provided string becomes the value. -If the key needs to contain special characters (spaces, commas, '::', start with a number, etc), -it is also possible to pass a python dictionary with arbitrary strings for both the key and -value and enabling special characters in the key. + If the key needs to contain special characters (spaces, commas, '::', start with a number, etc), + it is also possible to pass a python dictionary with arbitrary strings for both the key and + value and enabling special characters in the key. -.. note:: This decorator is a implementation of the Q_CLASSINFO macro. + .. note:: This decorator is a implementation of the ``Q_CLASSINFO`` macro. + Example + ------- -Example -------- + .. code-block:: python -.. code-block:: python + # Recommended syntax + @ClassInfo(Author='PySide Team', URL='http://www.pyside.org') + class MyObject(QObject): + ... - # Recommended syntax - @ClassInfo(Author='PySide Team', URL='http://www.pyside.org') - class MyObject(QObject): - ... - - # Provided to support keys not supported by Python's keyword syntax - @ClassInfo({'Some key text $': 'This syntax supports special characters in keys'}) - class MyObject(QObject): - ... + # Provided to support keys not supported by Python's keyword syntax + @ClassInfo({'Some key text $': 'This syntax supports special characters in keys'}) + class MyObject(QObject): + ... diff --git a/sources/pyside6/doc/extras/QtCore.Property.rst b/sources/pyside6/doc/extras/QtCore.Property.rst index 671b2dfe2..0e7a0ad64 100644 --- a/sources/pyside6/doc/extras/QtCore.Property.rst +++ b/sources/pyside6/doc/extras/QtCore.Property.rst @@ -1,133 +1,133 @@ .. currentmodule:: PySide6.QtCore .. py:class:: Property -Detailed Description --------------------- + Detailed Description + -------------------- -The Property function lets you declare properties that -behave both as Qt and Python properties, and have their -getters and setters defined as Python functions. + The Property function lets you declare properties that + behave both as Qt and Python properties, and have their + getters and setters defined as Python functions. -They are equivalent to the ``Q_PROPERTY`` macro in the `Qt Docs`_. + They are equivalent to the ``Q_PROPERTY`` macro in the `Qt Docs`_. -Here is an example that illustrates how to use this -function: + Here is an example that illustrates how to use this + function: -.. code-block:: python - :linenos: + .. code-block:: python + :linenos: - from PySide6.QtCore import QObject, Property + from PySide6.QtCore import QObject, Property - class MyObject(QObject): - def __init__(self, startval=42): - QObject.__init__(self) - self.ppval = startval + class MyObject(QObject): + def __init__(self, startval=42): + QObject.__init__(self) + self.ppval = startval - def readPP(self): - return self.ppval + def readPP(self): + return self.ppval - def setPP(self, val): - self.ppval = val + def setPP(self, val): + self.ppval = val - pp = Property(int, readPP, setPP) + pp = Property(int, readPP, setPP) - obj = MyObject() - obj.pp = 47 - print(obj.pp) + obj = MyObject() + obj.pp = 47 + print(obj.pp) -The full options for ``QtCore.Property`` can be found with ``QtCore.Property.__doc__``: + The full options for ``QtCore.Property`` can be found with ``QtCore.Property.__doc__``: -.. code-block:: python + .. code-block:: python - Property(self, type: type, - fget: Optional[Callable] = None, - fset: Optional[Callable] = None, - freset: Optional[Callable] = None, - fdel: Optional[Callable] = None, - doc: str = '', - notify: Optional[Callable] = None, - designable: bool = True, - scriptable: bool = True, - stored: bool = True, user: bool = False, - constant: bool = False, - final: bool = False) -> PySide6.QtCore.Property + Property(self, type: type, + fget: Optional[Callable] = None, + fset: Optional[Callable] = None, + freset: Optional[Callable] = None, + fdel: Optional[Callable] = None, + doc: str = '', + notify: Optional[Callable] = None, + designable: bool = True, + scriptable: bool = True, + stored: bool = True, user: bool = False, + constant: bool = False, + final: bool = False) -> PySide6.QtCore.Property -Normally, only ``type``, ``fget``and ``fset`` are used. + Normally, only ``type``, ``fget``and ``fset`` are used. -Properties compared with Python properties ------------------------------------------- + Properties compared with Python properties + ------------------------------------------ -``Python`` has property objects very similar to ``QtCore.Property``. -Despite the fact that the latter has an extra ``freset`` function, the usage -of properties is almost the same. The main difference is that ``QtCore.Property`` -requires a ``type`` parameter. + ``Python`` has property objects very similar to ``QtCore.Property``. + Despite the fact that the latter has an extra ``freset`` function, the usage + of properties is almost the same. The main difference is that ``QtCore.Property`` + requires a ``type`` parameter. -.. note:: ``Python`` property objects do *not* work in QML; ``QtCore.Property`` - needs to be used. + .. note:: ``Python`` property objects do *not* work in QML; ``QtCore.Property`` + needs to be used. -In the above example, the following lines would be equivalent properties: + In the above example, the following lines would be equivalent properties: -.. code-block:: python + .. code-block:: python - pp = QtCore.Property(int, readPP, setPP) # PySide version - pp = property(readPP, setPP) # Python version + pp = QtCore.Property(int, readPP, setPP) # PySide version + pp = property(readPP, setPP) # Python version -As you know from the `Python Docs`_, ``Python`` allows to break the property -creation into multiple steps, using the decorator syntax. We can do this in -``PySide`` as well: + As you know from the `Python Docs`_, ``Python`` allows to break the property + creation into multiple steps, using the decorator syntax. We can do this in + ``PySide`` as well: -.. code-block:: python - :linenos: + .. code-block:: python + :linenos: - from PySide6.QtCore import QObject, Property + from PySide6.QtCore import QObject, Property - class MyObject(QObject): - def __init__(self, startval=42): - QObject.__init__(self) - self.ppval = startval + class MyObject(QObject): + def __init__(self, startval=42): + QObject.__init__(self) + self.ppval = startval - @Property(int) - def pp(self): - return self.ppval + @Property(int) + def pp(self): + return self.ppval - @pp.setter - def pp(self, val): - self.ppval = val + @pp.setter + def pp(self, val): + self.ppval = val - obj = MyObject() - obj.pp = 47 - print(obj.pp) + obj = MyObject() + obj.pp = 47 + print(obj.pp) -Please be careful here: The two ``Python`` functions have the same name, intentionally. -This is needed to let ``Python`` know that these functions belong to the same property. + Please be careful here: The two ``Python`` functions have the same name, intentionally. + This is needed to let ``Python`` know that these functions belong to the same property. -Properties in QML expressions ------------------------------ + Properties in QML expressions + ----------------------------- -If you are using properties of your objects in QML expressions, -QML requires that the property changes are notified. Here is an -example illustrating how to do this: + If you are using properties of your objects in QML expressions, + QML requires that the property changes are notified. Here is an + example illustrating how to do this: -.. code-block:: python - :linenos: + .. code-block:: python + :linenos: - from PySide6.QtCore import QObject, Signal, Property + from PySide6.QtCore import QObject, Signal, Property - class Person(QObject): + class Person(QObject): - name_changed = Signal() + name_changed = Signal() - def __init__(self, name): - QObject.__init__(self) - self._person_name = name + def __init__(self, name): + QObject.__init__(self) + self._person_name = name - def _name(self): - return self._person_name + def _name(self): + return self._person_name - name = Property(str, _name, notify=name_changed) + name = Property(str, _name, notify=name_changed) .. _`Python Docs`: https://docs.python.org/3/library/functions.html?highlight=property#property .. _`Qt Docs`: https://doc.qt.io/qt-6/properties.html diff --git a/sources/pyside6/doc/extras/QtCore.QEnum.rst b/sources/pyside6/doc/extras/QtCore.QEnum.rst index 7ea35d8af..4b264e38c 100644 --- a/sources/pyside6/doc/extras/QtCore.QEnum.rst +++ b/sources/pyside6/doc/extras/QtCore.QEnum.rst @@ -1,27 +1,27 @@ .. currentmodule:: PySide6.QtCore .. py:decorator:: QEnum -This class decorator is equivalent to the `Q_ENUM` macro from Qt. The decorator -is used to register a Python Enum derived class to the meta-object system, -which is available via `QObject.staticMetaObject`. The enumerator must be in a -QObject derived class to be registered. + This class decorator is equivalent to the `Q_ENUM` macro from Qt. The decorator + is used to register a Python Enum derived class to the meta-object system, + which is available via `QObject.staticMetaObject`. The enumerator must + be in a :class:`QObject` derived class to be registered. -Example -------- + Example + ------- -:: + :: - from enum import Enum, auto + from enum import Enum, auto - from PySide6.QtCore import QEnum, QObject + from PySide6.QtCore import QEnum, QObject - class Demo(QObject): + class Demo(QObject): - @QEnum - class Orientation(Enum): - North, East, South, West = range(4) + @QEnum + class Orientation(Enum): + North, East, South, West = range(4) -See :deco:`QFlag` for registering Python Flag derived classes. + See :deco:`QFlag` for registering Python Flag derived classes. -Meanwhile all enums and flags have been converted to Python Enums -(default since ``PySide 6.4``), see the :ref:`NewEnumSystem` section. + Meanwhile all enums and flags have been converted to Python Enums + (default since ``PySide 6.4``), see the :ref:`NewEnumSystem` section. diff --git a/sources/pyside6/doc/extras/QtCore.QFlag.rst b/sources/pyside6/doc/extras/QtCore.QFlag.rst index dd4f02800..3b531327d 100644 --- a/sources/pyside6/doc/extras/QtCore.QFlag.rst +++ b/sources/pyside6/doc/extras/QtCore.QFlag.rst @@ -1,74 +1,74 @@ .. currentmodule:: PySide6.QtCore .. py:decorator:: QFlag -QFlag handles a variation of the Python Enum, the Flag class. + QFlag handles a variation of the Python Enum, the Flag class. -Please do not confuse that with the Qt QFlags concept. Python does -not use that concept, it has its own class hierarchy, instead. -For more details, see the `Python enum documentation <https://docs.python.org/3/library/enum.html>`_. + Please do not confuse that with the Qt QFlags concept. Python does + not use that concept, it has its own class hierarchy, instead. + For more details, see the `Python enum documentation <https://docs.python.org/3/library/enum.html>`_. -Example -------- + Example + ------- -:: + :: - from enum import Flag, auto + from enum import Flag, auto - from PySide6.QtCore import QFlag, QObject + from PySide6.QtCore import QFlag, QObject - class Demo(QObject): + class Demo(QObject): - @QFlag - class Color(Flag): - RED = auto() - BLUE = auto() - GREEN = auto() - WHITE = RED | BLUE | GREEN + @QFlag + class Color(Flag): + RED = auto() + BLUE = auto() + GREEN = auto() + WHITE = RED | BLUE | GREEN -Details about Qt Flags: ------------------------ + Details about Qt Flags: + ----------------------- -There are some small differences between Qt flags and Python flags. -In Qt, we have for instance these declarations: + There are some small differences between Qt flags and Python flags. + In Qt, we have for instance these declarations: -:: + :: - enum QtGui::RenderHint { Antialiasing, TextAntialiasing, SmoothPixmapTransform, - HighQualityAntialiasing, NonCosmeticDefaultPen } - flags QtGui::RenderHints + enum QtGui::RenderHint { Antialiasing, TextAntialiasing, SmoothPixmapTransform, + HighQualityAntialiasing, NonCosmeticDefaultPen } + flags QtGui::RenderHints -The equivalent Python notation would look like this: + The equivalent Python notation would look like this: -:: + :: - @QFlag - class RenderHints(enum.Flag) - Antialiasing = auto() - TextAntialiasing = auto() - SmoothPixmapTransform = auto() - HighQualityAntialiasing = auto() - NonCosmeticDefaultPen = auto() + @QFlag + class RenderHints(enum.Flag) + Antialiasing = auto() + TextAntialiasing = auto() + SmoothPixmapTransform = auto() + HighQualityAntialiasing = auto() + NonCosmeticDefaultPen = auto() -As another example, the Qt::AlignmentFlag flag has 'AlignmentFlag' as the enum -name, but 'Alignment' as the type name. Non flag enums have the same type and -enum names. + As another example, the Qt::AlignmentFlag flag has 'AlignmentFlag' as the enum + name, but 'Alignment' as the type name. Non flag enums have the same type and + enum names. -:: + :: - enum Qt::AlignmentFlag - flags Qt::Alignment + enum Qt::AlignmentFlag + flags Qt::Alignment -The Python way to specify this would be + The Python way to specify this would be -:: + :: - @QFlag - class Alignment(enum.Flag): - ... + @QFlag + class Alignment(enum.Flag): + ... -See :deco:`QEnum` for registering Python Enum derived classes. + See :deco:`QEnum` for registering Python Enum derived classes. -Meanwhile all enums and flags have been converted to Python Enums -(default since ``PySide 6.4``), see the :ref:`NewEnumSystem` section. + Meanwhile all enums and flags have been converted to Python Enums + (default since ``PySide 6.4``), see the :ref:`NewEnumSystem` section. diff --git a/sources/pyside6/doc/extras/QtCore.Slot.rst b/sources/pyside6/doc/extras/QtCore.Slot.rst index 98a1d465b..a75526c36 100644 --- a/sources/pyside6/doc/extras/QtCore.Slot.rst +++ b/sources/pyside6/doc/extras/QtCore.Slot.rst @@ -1,42 +1,42 @@ .. currentmodule:: PySide6.QtCore .. py:decorator:: Slot([type1 [, type2...]] [, name="" [, result=None, [tag=""]]]) - :param name: str - :param result: type - :param tag: str + :param name: str + :param result: type + :param tag: str -``Slot`` takes a list of Python types of the arguments. + ``Slot`` takes a list of Python types of the arguments. -The optional named argument ``name`` defines the slot name. If nothing is -passed, the slot name will be the decorated function name. + The optional named argument ``name`` defines the slot name. If nothing is + passed, the slot name will be the decorated function name. -The optional named argument ``result`` specifies the return type. + The optional named argument ``result`` specifies the return type. -The optional named argument ``tag`` specifies a value to be returned -by ``QMetaMethod.tag()``. + The optional named argument ``tag`` specifies a value to be returned + by :meth:`QMetaMethod.tag`. -This implementation is functionally compatible with the PyQt one. + This implementation is functionally compatible with the PyQt one. -======= =========== ====== -Module PyQt PySide -======= =========== ====== -QtCore pyqtSignal Signal -QtCore pyqtSlot Slot -======= =========== ====== + ======= =========== ====== + Module PyQt PySide + ======= =========== ====== + QtCore pyqtSignal Signal + QtCore pyqtSlot Slot + ======= =========== ====== -.. seealso:: :ref:`signals-and-slots` + .. seealso:: :ref:`signals-and-slots` -Q_INVOKABLE ------------ + Q_INVOKABLE + ----------- -There is no equivalent of the Q_INVOKABLE macro of Qt -since PySide6 slots can actually have return values. -If you need to create a invokable method that returns some value, -declare it as a slot, e.g.: + There is no equivalent of the Q_INVOKABLE macro of Qt + since PySide6 slots can actually have return values. + If you need to create a invokable method that returns some value, + declare it as a slot, e.g.: -:: + :: - class Foo(QObject): - @Slot(float, result=int) - def getFloatReturnInt(self, f): - return int(f) + class Foo(QObject): + @Slot(float, result=int) + def getFloatReturnInt(self, f): + return int(f) diff --git a/sources/pyside6/doc/extras/QtDesigner.QPyDesignerContainerExtension.rst b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerContainerExtension.rst index a3e5ef511..a4f03e4ad 100644 --- a/sources/pyside6/doc/extras/QtDesigner.QPyDesignerContainerExtension.rst +++ b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerContainerExtension.rst @@ -1,9 +1,9 @@ .. currentmodule:: PySide6.QtDesigner .. py:class:: QPyDesignerContainerExtension -QPyDesignerContainerExtension is the base class for implementing -`QDesignerContainerExtension class`_ -for a *Qt Widgets Designer* custom widget plugin in Python. -It provides the required inheritance from **QObject**. + QPyDesignerContainerExtension is the base class for implementing + `QDesignerContainerExtension class`_ + for a *Qt Widgets Designer* custom widget plugin in Python. + It provides the required inheritance from :class:`~PySide6.QtCore.QObject`. .. _QDesignerContainerExtension class: https://doc.qt.io/qt-6/qdesignercontainerextension.html diff --git a/sources/pyside6/doc/extras/QtDesigner.QPyDesignerCustomWidgetCollection.rst b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerCustomWidgetCollection.rst index 615ca4eec..083fb1f76 100644 --- a/sources/pyside6/doc/extras/QtDesigner.QPyDesignerCustomWidgetCollection.rst +++ b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerCustomWidgetCollection.rst @@ -1,52 +1,50 @@ .. currentmodule:: PySide6.QtDesigner .. py:class:: QPyDesignerCustomWidgetCollection -Synopsis --------- + Synopsis + -------- -Functions -^^^^^^^^^ + Methods + ^^^^^^^ -+------------------------------------------------------------------------------------------------+ -|def :meth:`registerCustomWidget<QPyDesignerCustomWidgetCollection.registerCustomWidget>` (type) | -+------------------------------------------------------------------------------------------------+ -|def :meth:`addCustomWidget<QPyDesignerCustomWidgetCollection.addCustomWidget>` (custom_widget) | -+------------------------------------------------------------------------------------------------+ + .. container:: function_list -Detailed Description --------------------- + def :meth:`registerCustomWidget` + def :meth:`addCustomWidget` -The :class:`~.QPyDesignerCustomWidgetCollection` implements -`QDesignerCustomWidgetCollectionInterface <https://doc.qt.io/qt-6/qdesignercustomwidgetcollectioninterface.html>`_ -and provides static helper functions for registering custom widgets by -type or by implementing -`QDesignerCustomWidgetInterface`_ . + Detailed Description + -------------------- -The usage is explained in :ref:`designer_custom_widgets`. + The :class:`~.QPyDesignerCustomWidgetCollection` implements + `QDesignerCustomWidgetCollectionInterface <https://doc.qt.io/qt-6/qdesignercustomwidgetcollectioninterface.html>`_ + and provides static helper functions for registering custom widgets by + type or by implementing `QDesignerCustomWidgetInterface`_ . -.. py:staticmethod:: QPyDesignerCustomWidgetCollection.registerCustomWidget(type[, xml=""[, tool_tip=""[, icon=""[, group=""[container=False]]]]]) + The usage is explained in :ref:`designer_custom_widgets`. - Registers an instance of a Python-implemented QWidget by type with - *Qt Widgets Designer*. + .. py:staticmethod:: QPyDesignerCustomWidgetCollection.registerCustomWidget(type[, xml=""[, tool_tip=""[, icon=""[, group=""[container=False]]]]]) - The optional keyword arguments correspond to the getters of - `QDesignerCustomWidgetInterface`_ : + :param str xml: A snippet of XML code in ``.ui`` format that specifies how the widget is created and sets initial property values. + :param str tool_tip: Tool tip to be shown in the widget box. + :param str icon: Path to an icon file be shown in the widget box. + :param str group: Category for grouping widgets in the widget box. + :param str module: Module name for generating the import code by `uic <https://doc.qt.io/qt-6/uic.html>`_ . + :param bool container: Indicates whether the widget is a container like `QGroupBox`, that is, child widgets can be placed on it. - :param str xml: A snippet of XML code in ``.ui`` format that specifies how the widget is created and sets initial property values. - :param str tool_tip: Tool tip to be shown in the widget box. - :param str icon: Path to an icon file be shown in the widget box. - :param str group: Category for grouping widgets in the widget box. - :param str module: Module name for generating the import code by `uic <https://doc.qt.io/qt-6/uic.html>`_ . - :param bool container: Indicates whether the widget is a container like `QGroupBox`, that is, child widgets can be placed on it. + Registers an instance of a Python-implemented QWidget by type with + *Qt Widgets Designer*. - .. seealso:: :meth:`registerCustomWidget()<PySide6.QtUiTools.QUiLoader.registerCustomWidget>` + The optional keyword arguments correspond to the getters of + `QDesignerCustomWidgetInterface`_ : -.. py:staticmethod:: QPyDesignerCustomWidgetCollection.addCustomWidget(custom_widget) + .. seealso:: :meth:`registerCustomWidget()<PySide6.QtUiTools.QUiLoader.registerCustomWidget>` - Adds a custom widget (implementation of - `QDesignerCustomWidgetInterface`_) - with *Qt Widgets Designer*. + .. py:staticmethod:: QPyDesignerCustomWidgetCollection.addCustomWidget(custom_widget) - :param QDesignerCustomWidgetInterface custom_widget: Custom widget instance + :param QDesignerCustomWidgetInterface custom_widget: Custom widget instance + + Adds a custom widget (implementation of + `QDesignerCustomWidgetInterface`_) + with *Qt Widgets Designer*. .. _QDesignerCustomWidgetInterface: https://doc.qt.io/qt-6/qdesignercustomwidgetinterface.html diff --git a/sources/pyside6/doc/extras/QtDesigner.QPyDesignerMemberSheetExtension.rst b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerMemberSheetExtension.rst index ef2356221..5979d8af4 100644 --- a/sources/pyside6/doc/extras/QtDesigner.QPyDesignerMemberSheetExtension.rst +++ b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerMemberSheetExtension.rst @@ -1,9 +1,9 @@ .. currentmodule:: PySide6.QtDesigner .. py:class:: QPyDesignerMemberSheetExtension -QPyDesignerMemberSheetExtension is the base class for implementing -`QDesignerMemberSheetExtension class`_ -for a *Qt Widgets Designer* custom widget plugin in Python. -It provides the required inheritance from **QObject**. + QPyDesignerMemberSheetExtension is the base class for implementing + `QDesignerMemberSheetExtension class`_ + for a *Qt Widgets Designer* custom widget plugin in Python. + It provides the required inheritance from :class:`~PySide6.QtCore.QObject`. .. _QDesignerMemberSheetExtension class: https://doc.qt.io/qt-6/qdesignermembersheetextension.html diff --git a/sources/pyside6/doc/extras/QtDesigner.QPyDesignerTaskMenuExtension.rst b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerTaskMenuExtension.rst index e5e13122d..cf9191150 100644 --- a/sources/pyside6/doc/extras/QtDesigner.QPyDesignerTaskMenuExtension.rst +++ b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerTaskMenuExtension.rst @@ -1,9 +1,9 @@ .. currentmodule:: PySide6.QtDesigner .. py:class:: QPyDesignerTaskMenuExtension -QPyDesignerTaskMenuExtension is the base class for implementing -`QDesignerTaskMenuExtension class`_ -for a *Qt Widgets Designer* custom widget plugin in Python. -It provides the required inheritance from **QObject**. + QPyDesignerTaskMenuExtension is the base class for implementing + `QDesignerTaskMenuExtension class`_ + for a *Qt Widgets Designer* custom widget plugin in Python. + It provides the required inheritance from :class:`~PySide6.QtCore.QObject`. .. _QDesignerTaskMenuExtension class: https://doc.qt.io/qt-6/qdesignertaskmenuextension.html diff --git a/sources/pyside6/doc/extras/QtQml.QPyQmlParserStatus.rst b/sources/pyside6/doc/extras/QtQml.QPyQmlParserStatus.rst index 10dde6b9a..19773ea55 100644 --- a/sources/pyside6/doc/extras/QtQml.QPyQmlParserStatus.rst +++ b/sources/pyside6/doc/extras/QtQml.QPyQmlParserStatus.rst @@ -1,9 +1,9 @@ .. currentmodule:: PySide6.QtQml .. py:class:: QPyQmlParserStatus -QPyQmlParserStatus is the base class for implementing -`QQmlParserStatus class`_ . + QPyQmlParserStatus is the base class for implementing + `QQmlParserStatus class`_ . -It provides the required inheritance from **QObject**. + It provides the required inheritance from :class:`~PySide6.QtCore.QObject`. .. _QQmlParserStatus class: https://doc.qt.io/qt-6/qqmlparserstatus.html diff --git a/sources/pyside6/doc/extras/QtQml.QPyQmlPropertyValueSource.rst b/sources/pyside6/doc/extras/QtQml.QPyQmlPropertyValueSource.rst index bf7f8e98f..86431a582 100644 --- a/sources/pyside6/doc/extras/QtQml.QPyQmlPropertyValueSource.rst +++ b/sources/pyside6/doc/extras/QtQml.QPyQmlPropertyValueSource.rst @@ -1,9 +1,9 @@ .. currentmodule:: PySide6.QtQml .. py:class:: QPyQmlPropertyValueSource -QPyQmlPropertyValueSource is the base class for implementing -`QQmlPropertyValueSource class`_ . + QPyQmlPropertyValueSource is the base class for implementing + `QQmlPropertyValueSource class`_ . -It provides the required inheritance from **QObject**. + It provides the required inheritance from :class:`~PySide6.QtCore.QObject`. .. _QQmlPropertyValueSource class: https://doc.qt.io/qt-6/qqmlpropertyvaluesource.html diff --git a/sources/pyside6/doc/extras/QtQml.QmlAnonymous.rst b/sources/pyside6/doc/extras/QtQml.QmlAnonymous.rst index 44aa0ea21..6320f0ce3 100644 --- a/sources/pyside6/doc/extras/QtQml.QmlAnonymous.rst +++ b/sources/pyside6/doc/extras/QtQml.QmlAnonymous.rst @@ -1,17 +1,17 @@ .. currentmodule:: PySide6.QtQml .. py:decorator:: QmlAnonymous -Declares the enclosing type to be available, but anonymous in QML. The type -cannot be created or used to declare properties in QML, but when passed from -C++, it is recognized. In QML, you can use properties of this type if they -are declared in C++. + Declares the enclosing type to be available, but anonymous in QML. The type + cannot be created or used to declare properties in QML, but when passed from + C++, it is recognized. In QML, you can use properties of this type if they + are declared in C++. -.. code-block:: python + .. code-block:: python - QML_IMPORT_NAME = "com.library.name" - QML_IMPORT_MAJOR_VERSION = 1 - QML_IMPORT_MINOR_VERSION = 0 # Optional + QML_IMPORT_NAME = "com.library.name" + QML_IMPORT_MAJOR_VERSION = 1 + QML_IMPORT_MINOR_VERSION = 0 # Optional - @QmlAnonymous - class ClassForQml(QObject): - # ... + @QmlAnonymous + class ClassForQml(QObject): + # ... diff --git a/sources/pyside6/doc/extras/QtQml.QmlAttached.rst b/sources/pyside6/doc/extras/QtQml.QmlAttached.rst index 4331b03f9..aee6d6fd8 100644 --- a/sources/pyside6/doc/extras/QtQml.QmlAttached.rst +++ b/sources/pyside6/doc/extras/QtQml.QmlAttached.rst @@ -1,35 +1,35 @@ .. currentmodule:: PySide6.QtQml .. py:decorator:: QmlAttached -This decorator declares that the enclosing type attaches the type passed as -an attached property to other types. This takes effect if the type is exposed -to QML using a ``QmlElement()`` or ``@QmlNamedElement()`` decorator. + This decorator declares that the enclosing type attaches the type passed as + an attached property to other types. This takes effect if the type is exposed + to QML using a :deco:`QmlElement` or :deco:`QmlNamedElement` decorator. -.. code-block:: python + .. code-block:: python - QML_IMPORT_NAME = "com.library.name" - QML_IMPORT_MAJOR_VERSION = 1 - QML_IMPORT_MINOR_VERSION = 0 # Optional + QML_IMPORT_NAME = "com.library.name" + QML_IMPORT_MAJOR_VERSION = 1 + QML_IMPORT_MINOR_VERSION = 0 # Optional - @QmlAnonymous - class LayoutAttached(QObject): - @Property(QMargins) - def margins(self): - ... + @QmlAnonymous + class LayoutAttached(QObject): + @Property(QMargins) + def margins(self): + ... - @QmlElement() - @QmlAttached(LayoutAttached) - class Layout(QObject): - ... + @QmlElement() + @QmlAttached(LayoutAttached) + class Layout(QObject): + ... -Afterwards the class may be used in QML: + Afterwards the class may be used in QML: -.. code-block:: javascript + .. code-block:: javascript - import com.library.name 1.0 + import com.library.name 1.0 - Layout { - Widget { - Layout.margins: [2, 2, 2, 2] - } - } + Layout { + Widget { + Layout.margins: [2, 2, 2, 2] + } + } diff --git a/sources/pyside6/doc/extras/QtQml.QmlElement.rst b/sources/pyside6/doc/extras/QtQml.QmlElement.rst index 66397b2d9..a7443b49f 100644 --- a/sources/pyside6/doc/extras/QtQml.QmlElement.rst +++ b/sources/pyside6/doc/extras/QtQml.QmlElement.rst @@ -1,25 +1,25 @@ .. currentmodule:: PySide6.QtQml .. py:decorator:: QmlElement -This decorator registers a class it is attached to for use in QML, using -global variables to specify the import name and version. + This decorator registers a class it is attached to for use in QML, using + global variables to specify the import name and version. -.. code-block:: python + .. code-block:: python - QML_IMPORT_NAME = "com.library.name" - QML_IMPORT_MAJOR_VERSION = 1 - QML_IMPORT_MINOR_VERSION = 0 # Optional + QML_IMPORT_NAME = "com.library.name" + QML_IMPORT_MAJOR_VERSION = 1 + QML_IMPORT_MINOR_VERSION = 0 # Optional - @QmlElement - class ClassForQml(QObject): - # ... + @QmlElement + class ClassForQml(QObject): + # ... -Afterwards the class may be used in QML: + Afterwards the class may be used in QML: -.. code-block:: python + .. code-block:: python - import com.library.name 1.0 + import com.library.name 1.0 - ClassForQml { - // ... - } + ClassForQml { + // ... + } diff --git a/sources/pyside6/doc/extras/QtQml.QmlExtended.rst b/sources/pyside6/doc/extras/QtQml.QmlExtended.rst index af113a9c8..b7959bbb4 100644 --- a/sources/pyside6/doc/extras/QtQml.QmlExtended.rst +++ b/sources/pyside6/doc/extras/QtQml.QmlExtended.rst @@ -1,32 +1,32 @@ .. currentmodule:: PySide6.QtQml .. py:decorator:: QmlExtended -Declares that the enclosing type uses the type passed as an extension to -provide further properties, methods, and enumerations in QML. This takes effect -if the type is exposed to QML using a ``QmlElement()`` or ``QmlNamedElement()`` -decorator. + Declares that the enclosing type uses the type passed as an extension to + provide further properties, methods, and enumerations in QML. This takes effect + if the type is exposed to QML using a :deco:`QmlElement` or :deco:`QmlNamedElement` + decorator. -.. code-block:: python + .. code-block:: python - QML_IMPORT_NAME = "com.library.name" - QML_IMPORT_MAJOR_VERSION = 1 - QML_IMPORT_MINOR_VERSION = 0 # Optional + QML_IMPORT_NAME = "com.library.name" + QML_IMPORT_MAJOR_VERSION = 1 + QML_IMPORT_MINOR_VERSION = 0 # Optional - class LineEditExtension(QObject): - pass + class LineEditExtension(QObject): + pass - @QmlNamedElement("QLineEdit") - @QmlExtended(LineEditExtension) - @QmlForeign(QLineEdit) - class LineEditForeign(QObject): - ... + @QmlNamedElement("QLineEdit") + @QmlExtended(LineEditExtension) + @QmlForeign(QLineEdit) + class LineEditForeign(QObject): + ... -Afterwards the class may be used in QML: + Afterwards the class may be used in QML: -.. code-block:: javascript + .. code-block:: javascript - import com.library.name 1.0 + import com.library.name 1.0 - QLineEdit { - left_margin: 10 - } + QLineEdit { + left_margin: 10 + } diff --git a/sources/pyside6/doc/extras/QtQml.QmlForeign.rst b/sources/pyside6/doc/extras/QtQml.QmlForeign.rst index 90b821e9b..44f5fdf7e 100644 --- a/sources/pyside6/doc/extras/QtQml.QmlForeign.rst +++ b/sources/pyside6/doc/extras/QtQml.QmlForeign.rst @@ -1,28 +1,28 @@ .. currentmodule:: PySide6.QtQml .. py:decorator:: QmlForeign -This decorator can be used to change the type that is created by QML. + This decorator can be used to change the type that is created by QML. -This is useful for registering types that cannot be amended by adding the -QmlElement decorator, for example because they belong to 3rdparty libraries. + This is useful for registering types that cannot be amended by adding the + :deco:`QmlElement` decorator, for example because they belong to 3rdparty libraries. -.. code-block:: python + .. code-block:: python - QML_IMPORT_NAME = "com.library.name" - QML_IMPORT_MAJOR_VERSION = 1 - QML_IMPORT_MINOR_VERSION = 0 # Optional + QML_IMPORT_NAME = "com.library.name" + QML_IMPORT_MAJOR_VERSION = 1 + QML_IMPORT_MINOR_VERSION = 0 # Optional - @QmlNamedElement("QWidget") - @QmlForeign(QWidget) - class ForeignWidgetHelperClass(QObject): - ... + @QmlNamedElement("QWidget") + @QmlForeign(QWidget) + class ForeignWidgetHelperClass(QObject): + ... -Afterwards the class may be used in QML: + Afterwards the class may be used in QML: -.. code-block:: javascript + .. code-block:: javascript - import com.library.name 1.0 + import com.library.name 1.0 - QWidget { - // ... - } + QWidget { + // ... + } diff --git a/sources/pyside6/doc/extras/QtQml.QmlNamedElement.rst b/sources/pyside6/doc/extras/QtQml.QmlNamedElement.rst index 79eb9d7ad..1ce8bd796 100644 --- a/sources/pyside6/doc/extras/QtQml.QmlNamedElement.rst +++ b/sources/pyside6/doc/extras/QtQml.QmlNamedElement.rst @@ -1,26 +1,26 @@ .. currentmodule:: PySide6.QtQml .. py:decorator:: QmlNamedElement -This decorator registers a class it is attached to for use in QML under -a name different from the class name, using global variables to specify -the import name and version. + This decorator registers a class it is attached to for use in QML under + a name different from the class name, using global variables to specify + the import name and version. -.. code-block:: python + .. code-block:: python - QML_IMPORT_NAME = "com.library.name" - QML_IMPORT_MAJOR_VERSION = 1 - QML_IMPORT_MINOR_VERSION = 0 # Optional + QML_IMPORT_NAME = "com.library.name" + QML_IMPORT_MAJOR_VERSION = 1 + QML_IMPORT_MINOR_VERSION = 0 # Optional - @QmlNamedElement("ClassForQml") - class ClassWithSomeName(QObject): - ... + @QmlNamedElement("ClassForQml") + class ClassWithSomeName(QObject): + ... -Afterwards the class may be used in QML: + Afterwards the class may be used in QML: -.. code-block:: javascript + .. code-block:: javascript - import com.library.name 1.0 + import com.library.name 1.0 - ClassForQml { - // ... - } + ClassForQml { + // ... + } diff --git a/sources/pyside6/doc/extras/QtQml.QmlSingleton.rst b/sources/pyside6/doc/extras/QtQml.QmlSingleton.rst index 402c18d55..1c5173478 100644 --- a/sources/pyside6/doc/extras/QtQml.QmlSingleton.rst +++ b/sources/pyside6/doc/extras/QtQml.QmlSingleton.rst @@ -1,33 +1,34 @@ .. currentmodule:: PySide6.QtQml .. py:decorator:: QmlSingleton -Declares the decorated type to be a singleton in QML. This only takes effect if -the type is a QObject and is available in QML (by having a QmlElement decorator). -The QQmlEngine will try to create a singleton instance using the type's default -constructor. + Declares the decorated type to be a singleton in QML. This only takes effect if + the type is a :class:`~PySide6.QtCore.QObject` and is available in QML + (by having a :deco:`QmlElement` decorator). + The :class:`QQmlEngine` will try to create a singleton instance using the type's default + constructor. -.. code-block:: python + .. code-block:: python - QML_IMPORT_NAME = "com.library.name" - QML_IMPORT_MAJOR_VERSION = 1 - QML_IMPORT_MINOR_VERSION = 0 # Optional + QML_IMPORT_NAME = "com.library.name" + QML_IMPORT_MAJOR_VERSION = 1 + QML_IMPORT_MINOR_VERSION = 0 # Optional - @QmlElement - @QmlSingleton - class ClassForQml(QObject): - ... + @QmlElement + @QmlSingleton + class ClassForQml(QObject): + ... -It is also possible to use a static ``create()`` method which receives -the engine as a parameter: + It is also possible to use a static ``create()`` method which receives + the engine as a parameter: -.. code-block:: python + .. code-block:: python - @QmlElement - @QmlSingleton - class ClassForQml(QObject): + @QmlElement + @QmlSingleton + class ClassForQml(QObject): - @staticmethod - def create(engine): - ... + @staticmethod + def create(engine): + ... -.. note:: The order of the decorators matters; ``QmlSingleton`` needs to be preceded by ``QmlElement``. + .. note:: The order of the decorators matters; ``QmlSingleton`` needs to be preceded by ``QmlElement``. diff --git a/sources/pyside6/doc/extras/QtQml.QmlUncreatable.rst b/sources/pyside6/doc/extras/QtQml.QmlUncreatable.rst index b7a28801f..0810b123c 100644 --- a/sources/pyside6/doc/extras/QtQml.QmlUncreatable.rst +++ b/sources/pyside6/doc/extras/QtQml.QmlUncreatable.rst @@ -1,26 +1,26 @@ .. currentmodule:: PySide6.QtQml .. py:decorator:: QmlUncreatable -Declares that the decorated type shall not be creatable from QML. This takes -effect if the type is available in QML, by a preceding ``QmlElement`` -decorator. The reason will be emitted as error message if an attempt to create -the type from QML is detected. + Declares that the decorated type shall not be creatable from QML. This takes + effect if the type is available in QML, by a preceding :deco:`QmlElement` + decorator. The reason will be emitted as error message if an attempt to create + the type from QML is detected. -Some QML types are implicitly uncreatable, in particular types exposed with -``QmlAnonymous``. + Some QML types are implicitly uncreatable, in particular types exposed with + :deco:`QmlAnonymous`. -Passing None or no argument will cause a standard message to be used instead. + Passing None or no argument will cause a standard message to be used instead. -.. code-block:: python + .. code-block:: python - QML_IMPORT_NAME = "com.library.name" - QML_IMPORT_MAJOR_VERSION = 1 - QML_IMPORT_MINOR_VERSION = 0 # Optional + QML_IMPORT_NAME = "com.library.name" + QML_IMPORT_MAJOR_VERSION = 1 + QML_IMPORT_MINOR_VERSION = 0 # Optional - @QmlElement - @QmlUncreatable("BaseClassForQml is an abstract base class") - class BaseClassForQml(QObject): - ... + @QmlElement + @QmlUncreatable("BaseClassForQml is an abstract base class") + class BaseClassForQml(QObject): + ... -.. note:: The order of the decorators matters; ``QmlUncreatable`` needs to be preceded by ``QmlElement``. + .. note:: The order of the decorators matters; ``QmlUncreatable`` needs to be preceded by ``QmlElement``. |