blob: 00260860b774817e2e8b9af83375fed8ff5454c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
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
|