PySide6.QtDesigner.QExtensionManager

class QExtensionManager

The QExtensionManager class provides extension management facilities for Qt Widgets Designer. More

Inheritance diagram of PySide6.QtDesigner.QExtensionManager

Synopsis

Methods

Note

This documentation may contain snippets that were automatically translated from C++ to Python. We always welcome contributions to the snippet translation. If you see an issue with the translation, you can also let us know by creating a ticket on https:/bugreports.qt.io/projects/PYSIDE

Detailed Description

Warning

This section contains snippets that were automatically translated from C++ to Python and may contain errors.

In Qt Widgets Designer the extensions are not created until they are required. For that reason, when implementing an extension, you must also create a QExtensionFactory , i.e a class that is able to make an instance of your extension, and register it using Qt Widgets Designer’s extension manager.

The registration of an extension factory is typically made in the initialize() function:

def initialize(self, formEditor):

    if initialized:
        return
    manager = formEditor.extensionManager()
    Q_ASSERT(manager != None)
    manager.registerExtensions(MyExtensionFactory(manager),
                                Q_TYPEID(QDesignerTaskMenuExtension))
    initialized = True

The QExtensionManager is not intended to be instantiated directly. You can retrieve an interface to Qt Widgets Designer’s extension manager using the extensionManager() function. A pointer to Qt Widgets Designer’s current QDesignerFormEditorInterface object (formEditor in the example above) is provided by the initialize() function’s parameter. When implementing a custom widget plugin, you must subclass the QDesignerCustomWidgetInterface to expose your plugin to Qt Widgets Designer.

Then, when an extension is required, Qt Widgets Designer’s extension manager will run through all its registered factories calling createExtension() for each until the first one that is able to create the requested extension for the selected object, is found. This factory will then make an instance of the extension.

There are four available types of extensions in Qt Widgets Designer: QDesignerContainerExtension , QDesignerMemberSheetExtension , QDesignerPropertySheetExtension and QDesignerTaskMenuExtension . Qt Widgets Designer’s behavior is the same whether the requested extension is associated with a container, a member sheet, a property sheet or a task menu.

For a complete example using the QExtensionManager class, see the Task Menu Extension example . The example shows how to create a custom widget plugin for Qt Designer, and how to use the QDesignerTaskMenuExtension class to add custom items to Qt Widgets Designer’s task menu.

See also

QExtensionFactory QAbstractExtensionManager

__init__([parent=None])
Parameters:

parentQObject

Constructs an extension manager with the given parent.