Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
pluginmanager_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
4//
5// W A R N I N G
6// -------------
7//
8// This file is not part of the Qt API. It exists for the convenience
9// of Qt Designer. This header
10// file may change from version to version without notice, or even be removed.
11//
12// We mean it.
13//
14
15#ifndef PLUGINMANAGER_H
16#define PLUGINMANAGER_H
17
19#include "shared_enums_p.h"
20
21#include <QtCore/qshareddata.h>
22#include <QtCore/qmap.h>
23#include <QtCore/qpair.h>
24#include <QtCore/qobject.h>
25#include <QtCore/qstringlist.h>
26
28
29class QDesignerFormEditorInterface;
32
34
35/* Information contained in the Dom XML of a custom widget. */
37public:
38 // StringPropertyType: validation mode and translatable flag.
39 using StringPropertyType = std::pair<qdesigner_internal::TextPropertyValidationMode, bool>;
40
41 explicit QDesignerCustomWidgetData(const QString &pluginPath = QString());
42
43 enum ParseResult { ParseOk, ParseWarning, ParseError };
44 ParseResult parseXml(const QString &xml, const QString &name, QString *errorMessage);
45
46 QDesignerCustomWidgetData(const QDesignerCustomWidgetData&);
47 QDesignerCustomWidgetData& operator=(const QDesignerCustomWidgetData&);
48 ~QDesignerCustomWidgetData();
49
50 bool isNull() const;
51
52 QString pluginPath() const;
53
54 // Data as parsed from the widget's domXML().
55 QString xmlClassName() const;
56 // Optional. The language the plugin is supposed to be used with.
57 QString xmlLanguage() const;
58 // Optional. method used to add pages to a container with a container extension
59 QString xmlAddPageMethod() const;
60 // Optional. Base class
61 QString xmlExtends() const;
62 // Optional. The name to be used in the widget box.
63 QString xmlDisplayName() const;
64 // Type of a string property
65 bool xmlStringPropertyType(const QString &name, StringPropertyType *type) const;
66 // Custom tool tip of property
67 QString propertyToolTip(const QString &name) const;
68
69private:
70 QSharedDataPointer<QDesignerCustomWidgetSharedData> m_d;
71};
72
74{
75 Q_OBJECT
76public:
77 using CustomWidgetList = QList<QDesignerCustomWidgetInterface *>;
78
79 explicit QDesignerPluginManager(QDesignerFormEditorInterface *core);
80 explicit QDesignerPluginManager(const QStringList &pluginPaths,
81 QDesignerFormEditorInterface *core);
82 ~QDesignerPluginManager() override;
83
84 QDesignerFormEditorInterface *core() const;
85
86 QObject *instance(const QString &plugin) const;
87
88 QStringList registeredPlugins() const;
89
90 QStringList findPlugins(const QString &path);
91
92 QStringList pluginPaths() const;
93 void setPluginPaths(const QStringList &plugin_paths);
94
95 QStringList disabledPlugins() const;
96 void setDisabledPlugins(const QStringList &disabled_plugins);
97
98 QStringList failedPlugins() const;
99 QString failureReason(const QString &pluginName) const;
100
101 QObjectList instances() const;
102
103 CustomWidgetList registeredCustomWidgets() const;
104 QDesignerCustomWidgetData customWidgetData(QDesignerCustomWidgetInterface *w) const;
105 QDesignerCustomWidgetData customWidgetData(const QString &className) const;
106
107 bool registerNewPlugins();
108
109 static QStringList defaultPluginPaths();
110
111public slots:
112 bool syncSettings();
113 void ensureInitialized();
114
115private:
116 void updateRegisteredPlugins();
117 void registerPath(const QString &path);
118 void registerPlugin(const QString &plugin);
119
120private:
121 QDesignerPluginManagerPrivate *m_d;
122};
123
124QT_END_NAMESPACE
125
126#endif // PLUGINMANAGER_H
friend class QWidget
Definition qpainter.h:421
QWidget * createPage(QWidget *parent) override
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
bool deviceProfileLessThan(const DeviceProfile &d1, const DeviceProfile &d2)
static bool ask(QWidget *parent, QDesignerDialogGuiInterface *dlgui, const QString &title, const QString &what)
#define QDESIGNER_SHARED_EXPORT