QExtensionManager Class▲
-
Header: QExtensionManager
-
qmake: QT += designer
-
Inherits: https:// and https://
Detailed Description▲
In Qt Designer the extensions are not created until they are required. For that reason, when implementing an extension, you must also create a https://, i.e a class that is able to make an instance of your extension, and register it using Qt Designer's extension manager.
The registration of an extension factory is typically made in the https://() function:
void MyPlugin::initialize(QDesignerFormEditorInterface *formEditor)
{
if (initialized)
return;
QExtensionManager *manager = formEditor->extensionManager();
Q_ASSERT(manager != 0);
manager->registerExtensions(new MyExtensionFactory(manager),
Q_TYPEID(QDesignerTaskMenuExtension));
initialized = true;
}The https:// is not intended to be instantiated directly. You can retrieve an interface to Qt Designer's extension manager using the https://() function. A pointer to Qt Designer's current https:// object (formEditor in the example above) is provided by the https://() function's parameter. When implementing a custom widget plugin, you must subclass the https:// to expose your plugin to Qt Designer.
Then, when an extension is required, Qt Designer's extension manager will run through all its registered factories calling https://() 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 Designer: https:// , https://, https:// and https://. Qt 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 https:// class, see the https://. The example shows how to create a custom widget plugin for Qt Designer, and how to to use the https:// class to add custom items to Qt Designer's task menu.
See Also▲
See also https://, https://
Member Function Documentation▲
[explicit] QExtensionManager::QExtensionManager(QObject *parent = Q_NULLPTR)▲
Constructs an extension manager with the given parent.
[virtual] QExtensionManager::~QExtensionManager()▲
Destroys the extension manager
[override virtual] QObject *QExtensionManager::extension(QObject *object, const QString &iid) const▲
Reimplements: https://.
Returns the extension specified by iid, for the given object.
[override virtual] void QExtensionManager::registerExtensions(QAbstractExtensionFactory *factory, const QString &iid = QString())▲
Reimplements: https://.
Register the extension specified by the given factory and extension identifier iid.
[override virtual] void QExtensionManager::unregisterExtensions(QAbstractExtensionFactory *factory, const QString &iid = QString())▲
Reimplements: https://.
Unregister the extension specified by the given factory and extension identifier iid.
Macro Documentation▲
Q_DECLARE_EXTENSION_INTERFACE(ExtensionName, Identifier)▲
Associates the given Identifier (a string literal) to the extension class called ExtensionName. The Identifier must be unique. For example:
Q_DECLARE_EXTENSION_INTERFACE(MyExtension, "com.mycompany.myproduct.myextension")Using the company and product names is a good way to ensure uniqueness of the identifier.
When implementing a custom extension class, you must use Q_DECLARE_EXTENSION_INTERFACE() to enable usage of the qt_extension() function. The macro is normally located right after the class definition for ExtensionName, in the associated header file.
See Also▲
See also Q_DECLARE_INTERFACE()


