diff options
Diffstat (limited to 'sources/pyside6')
5 files changed, 93 insertions, 16 deletions
diff --git a/sources/pyside6/doc/extras/QtDesigner.QPyDesignerContainerExtension.rst b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerContainerExtension.rst new file mode 100644 index 000000000..1baa9e369 --- /dev/null +++ b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerContainerExtension.rst @@ -0,0 +1,10 @@ +.. currentmodule:: PySide6.QtDesigner +.. _QPyDesignerContainerExtension: + +QPyDesignerContainerExtension +***************************** + +QPyDesignerContainerExtension is the base class for implementing +`QDesignerContainerExtension <https://doc.qt.io/qt-6/qdesignercontainerextension.html>`_ +for a Qt Designer custom widget plugin in Python. +It provides the required inheritance from **QObject**. diff --git a/sources/pyside6/doc/extras/QtDesigner.QPyDesignerCustomWidgetCollection.rst b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerCustomWidgetCollection.rst new file mode 100644 index 000000000..00260860b --- /dev/null +++ b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerCustomWidgetCollection.rst @@ -0,0 +1,52 @@ +.. currentmodule:: PySide6.QtDesigner +.. _QPyDesignerCustomWidgetCollection: + +QPyDesignerCustomWidgetCollection +********************************* + +Synopsis +-------- + +Functions +^^^^^^^^^ + ++------------------------------------------------------------------------------------------------+ +|def :meth:`registerCustomWidget<QPyDesignerCustomWidgetCollection.registerCustomWidget>` (type) | ++------------------------------------------------------------------------------------------------+ +|def :meth:`addCustomWidget<QPyDesignerCustomWidgetCollection.addCustomWidget>` (custom_widget) | ++------------------------------------------------------------------------------------------------+ + +Detailed Description +-------------------- + + 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 <https://doc.qt.io/qt-6/qdesignercustomwidgetinterface.html>`_ . + + The usage is explained in :ref:`designer_custom_widgets`. + +.. py:staticmethod:: QPyDesignerCustomWidgetCollection.registerCustomWidget(type[, xml=""[, tool_tip=""[, icon=""[, group=""[container=False]]]]]) + + Registers an instance of a Python-implemented QWidget by type with Qt Designer. + + The optional keyword arguments correspond to the getters of + `QDesignerCustomWidgetInterface <https://doc.qt.io/qt-6/qdesignercustomwidgetinterface.html>`_ : + + :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. + + .. seealso:: :meth:`registerCustomWidget()<PySide6.QtUiTools.QUiLoader.registerCustomWidget>` + +.. py:staticmethod:: QPyDesignerCustomWidgetCollection.addCustomWidget(custom_widget) + + Adds a custom widget (implementation of + `QDesignerCustomWidgetInterface <https://doc.qt.io/qt-6/qdesignercustomwidgetinterface.html>`_) + with Qt Designer. + + :param QDesignerCustomWidgetInterface custom_widget: Custom widget instance diff --git a/sources/pyside6/doc/extras/QtDesigner.QPyDesignerMemberSheetExtension.rst b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerMemberSheetExtension.rst new file mode 100644 index 000000000..c52aafdf5 --- /dev/null +++ b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerMemberSheetExtension.rst @@ -0,0 +1,10 @@ +.. currentmodule:: PySide6.QtDesigner +.. _QPyDesignerMemberSheetExtension: + +QPyDesignerMemberSheetExtension +******************************* + +QPyDesignerMemberSheetExtension is the base class for implementing +`QDesignerMemberSheetExtension <https://doc.qt.io/qt-6/qdesignermembersheetextension.html>`_ +for a Qt Designer custom widget plugin in Python. +It provides the required inheritance from **QObject**. diff --git a/sources/pyside6/doc/extras/QtDesigner.QPyDesignerTaskMenuExtension.rst b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerTaskMenuExtension.rst new file mode 100644 index 000000000..004c94693 --- /dev/null +++ b/sources/pyside6/doc/extras/QtDesigner.QPyDesignerTaskMenuExtension.rst @@ -0,0 +1,10 @@ +.. currentmodule:: PySide6.QtDesigner +.. _QPyDesignerTaskMenuExtension: + +QPyDesignerTaskMenuExtension +**************************** + +QPyDesignerTaskMenuExtension is the base class for implementing +`QDesignerTaskMenuExtension <https://doc.qt.io/qt-6/qdesignertaskmenuextension.html>`_ +for a Qt Designer custom widget plugin in Python. +It provides the required inheritance from **QObject**. diff --git a/sources/pyside6/doc/tutorials/basictutorial/uifiles.rst b/sources/pyside6/doc/tutorials/basictutorial/uifiles.rst index 2d2b2e584..2a7582ec9 100644 --- a/sources/pyside6/doc/tutorials/basictutorial/uifiles.rst +++ b/sources/pyside6/doc/tutorials/basictutorial/uifiles.rst @@ -186,6 +186,9 @@ command prompt: python main.py + +.. _designer_custom_widgets: + Custom Widgets in Qt Designer ============================= @@ -197,7 +200,7 @@ written in C++ implementing its `QDesignerCustomWidgetInterface <https://doc.qt.io/qt-6/qdesignercustomwidgetinterface.html>`_ . Qt for Python provides a simple interface for this which is similar to -`QUiLoader.registerCustomWidget()`. +:meth:`registerCustomWidget()<PySide6.QtUiTools.QUiLoader.registerCustomWidget>`. The widget needs to be provided as a Python module, as shown by the widgetbinding example (file ``wigglywidget.py``) or @@ -247,28 +250,20 @@ exposing custom widgets to **Qt Designer** with static convenience functions for registering types or adding instances of `QDesignerCustomWidgetInterface <https://doc.qt.io/qt-6/qdesignercustomwidgetinterface.html>`_ . -The function QPyDesignerCustomWidgetCollection.registerCustomWidget() is used -to register a widget type with **Qt Designer**. In the simple case, it can be -used like `QUiLoader.registerCustomWidget()`. It takes the custom widget type -and some optional keyword arguments passing values that correspond to the +The function +:meth:`registerCustomWidget()<PySide6.QtDesigner.QPyDesignerCustomWidgetCollection.registerCustomWidget>` +is used to register a widget type with **Qt Designer**. In the simple case, it +can be used like `QUiLoader.registerCustomWidget()`. It takes the custom widget +type and some optional keyword arguments passing values that correspond to the getters of `QDesignerCustomWidgetInterface <https://doc.qt.io/qt-6/qdesignercustomwidgetinterface.html>`_ : -* ``xml`` (str) A snippet of XML code in ``.ui`` format that specifies - how the widget is created and sets initial property values. -* ``tool_tip`` (str) Tool tip to be shown in the widget box. -* ``icon`` (str) Path to an icon file be shown in the widget box. -* ``group`` (str) Category for grouping widgets in the widget box. -* ``module`` (str) Module name for generating the import code by - `uic <https://doc.qt.io/qt-6/uic.html>`_ . -* ``container`` (bool) Indicates whether the widget is a container - like `QGroupBox`, that is, child widgets can be placed on it. - When launching **Qt Designer** via its launcher ``pyside6-designer``, the custom widget should be visible in the widget box. For advanced usage, it is also possible to pass the function an implementation -of the class QDesignerCustomWidgetInterface instead of the type. +of the class QDesignerCustomWidgetInterface instead of the type to +:meth:`addCustomWidget()<PySide6.QtDesigner.QPyDesignerCustomWidgetCollection.addCustomWidget>`. This is shown in taskmenuextension example, where a custom context menu is registered for the custom widget. The example is a port of the corresponding C++ |
