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// Qt-Security score:significant reason:default
4
5//
6// W A R N I N G
7// -------------
8//
9// This file is not part of the Qt API. It exists for the convenience
10// of Qt Designer. This header
11// file may change from version to version without notice, or even be removed.
12//
13// We mean it.
14//
15
16#ifndef PLUGINMANAGER_H
17#define PLUGINMANAGER_H
18
20#include "shared_enums_p.h"
21
22#include <QtCore/qshareddata.h>
23#include <QtCore/qmap.h>
24#include <QtCore/qobject.h>
25#include <QtCore/qstringlist.h>
26
27#include <utility>
28
29QT_BEGIN_NAMESPACE
30
31class QDesignerFormEditorInterface;
34
36
37/* Information contained in the Dom XML of a custom widget. */
39public:
40 // StringPropertyType: validation mode and translatable flag.
41 using StringPropertyType = std::pair<qdesigner_internal::TextPropertyValidationMode, bool>;
42
43 explicit QDesignerCustomWidgetData(const QString &pluginPath = QString());
44
45 enum ParseResult { ParseOk, ParseWarning, ParseError };
46 ParseResult parseXml(const QString &xml, const QString &name, QString *errorMessage);
47
48 QDesignerCustomWidgetData(const QDesignerCustomWidgetData&);
49 QDesignerCustomWidgetData& operator=(const QDesignerCustomWidgetData&);
50 ~QDesignerCustomWidgetData();
51
52 bool isNull() const;
53
54 QString pluginPath() const;
55
56 // Data as parsed from the widget's domXML().
57 QString xmlClassName() const;
58 // Optional. The language the plugin is supposed to be used with.
59 QString xmlLanguage() const;
60 // Optional. method used to add pages to a container with a container extension
61 QString xmlAddPageMethod() const;
62 // Optional. Base class
63 QString xmlExtends() const;
64 // Optional. The name to be used in the widget box.
65 QString xmlDisplayName() const;
66 // Type of a string property
67 bool xmlStringPropertyType(const QString &name, StringPropertyType *type) const;
68 // Custom tool tip of property
69 QString propertyToolTip(const QString &name) const;
70
71private:
72 QSharedDataPointer<QDesignerCustomWidgetSharedData> m_d;
73};
74
76{
77 Q_OBJECT
78public:
79 using CustomWidgetList = QList<QDesignerCustomWidgetInterface *>;
80
81 explicit QDesignerPluginManager(QDesignerFormEditorInterface *core);
82 explicit QDesignerPluginManager(const QStringList &pluginPaths,
83 QDesignerFormEditorInterface *core);
84 ~QDesignerPluginManager() override;
85
86 QDesignerFormEditorInterface *core() const;
87
88 QObject *instance(const QString &plugin) const;
89
90 QStringList registeredPlugins() const;
91
92 QStringList findPlugins(const QString &path);
93
94 QStringList pluginPaths() const;
95 void setPluginPaths(const QStringList &plugin_paths);
96
97 QStringList disabledPlugins() const;
98 void setDisabledPlugins(const QStringList &disabled_plugins);
99
100 QStringList failedPlugins() const;
101 QString failureReason(const QString &pluginName) const;
102
103 QObjectList instances() const;
104
105 CustomWidgetList registeredCustomWidgets() const;
106 QDesignerCustomWidgetData customWidgetData(QDesignerCustomWidgetInterface *w) const;
107 QDesignerCustomWidgetData customWidgetData(const QString &className) const;
108
109 bool registerNewPlugins();
110
111 static QStringList defaultPluginPaths();
112
113public slots:
114 bool syncSettings();
115 void ensureInitialized();
116
117private:
118 void updateRegisteredPlugins();
119 void registerPath(const QString &path);
120 void registerPlugin(const QString &plugin);
121
122private:
123 QDesignerPluginManagerPrivate *m_d;
124};
125
126QT_END_NAMESPACE
127
128#endif // PLUGINMANAGER_H
friend class QWidget
Definition qpainter.h:432
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)
static QString description(const DeviceProfile &p)
#define QDESIGNER_SHARED_EXPORT