1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Designer of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | #ifndef ABSTRACTINTEGRATION_H |
30 | #define ABSTRACTINTEGRATION_H |
31 | |
32 | #include <QtDesigner/sdk_global.h> |
33 | |
34 | #include <QtCore/qobject.h> |
35 | #include <QtCore/qscopedpointer.h> |
36 | #include <QtCore/qstringlist.h> |
37 | #include <QtCore/qflags.h> |
38 | |
39 | QT_BEGIN_NAMESPACE |
40 | |
41 | class QDesignerFormWindowInterface; |
42 | class QDesignerFormEditorInterface; |
43 | class QDesignerIntegrationInterfacePrivate; |
44 | class QDesignerResourceBrowserInterface; |
45 | class QVariant; |
46 | class QWidget; |
47 | |
48 | namespace qdesigner_internal { |
49 | class QDesignerIntegrationPrivate; |
50 | } |
51 | |
52 | class QDESIGNER_SDK_EXPORT QDesignerIntegrationInterface: public QObject |
53 | { |
54 | Q_OBJECT |
55 | Q_PROPERTY(QString headerSuffix READ headerSuffix WRITE setHeaderSuffix) |
56 | Q_PROPERTY(bool headerLowercase READ isHeaderLowercase WRITE setHeaderLowercase) |
57 | |
58 | public: |
59 | enum ResourceFileWatcherBehaviour |
60 | { |
61 | NoResourceFileWatcher, |
62 | ReloadResourceFileSilently, |
63 | PromptToReloadResourceFile // Default |
64 | }; |
65 | |
66 | enum FeatureFlag |
67 | { |
68 | ResourceEditorFeature = 0x1, |
69 | SlotNavigationFeature = 0x2, |
70 | DefaultWidgetActionFeature = 0x4, |
71 | DefaultFeature = ResourceEditorFeature | DefaultWidgetActionFeature |
72 | }; |
73 | Q_DECLARE_FLAGS(Feature, FeatureFlag) |
74 | |
75 | explicit QDesignerIntegrationInterface(QDesignerFormEditorInterface *core, QObject *parent = nullptr); |
76 | virtual ~QDesignerIntegrationInterface(); |
77 | |
78 | QDesignerFormEditorInterface *core() const; |
79 | |
80 | virtual QWidget *containerWindow(QWidget *widget) const = 0; |
81 | |
82 | // Create a resource browser specific to integration. Language integration takes precedence |
83 | virtual QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parent = nullptr) = 0; |
84 | virtual QString () const = 0; |
85 | virtual void (const QString &) = 0; |
86 | |
87 | virtual bool () const = 0; |
88 | virtual void (bool ) = 0; |
89 | |
90 | virtual Feature features() const = 0; |
91 | bool hasFeature(Feature f) const; |
92 | |
93 | virtual ResourceFileWatcherBehaviour resourceFileWatcherBehaviour() const = 0; |
94 | virtual void setResourceFileWatcherBehaviour(ResourceFileWatcherBehaviour behaviour) = 0; |
95 | |
96 | virtual QString contextHelpId() const = 0; |
97 | |
98 | void emitObjectNameChanged(QDesignerFormWindowInterface *formWindow, QObject *object, |
99 | const QString &newName, const QString &oldName); |
100 | void emitNavigateToSlot(const QString &objectName, const QString &signalSignature, const QStringList ¶meterNames); |
101 | void emitNavigateToSlot(const QString &slotSignature); |
102 | void emitHelpRequested(const QString &manual, const QString &document); |
103 | |
104 | Q_SIGNALS: |
105 | void propertyChanged(QDesignerFormWindowInterface *formWindow, const QString &name, const QVariant &value); |
106 | void objectNameChanged(QDesignerFormWindowInterface *formWindow, QObject *object, const QString &newName, const QString &oldName); |
107 | void helpRequested(const QString &manual, const QString &document); |
108 | |
109 | void navigateToSlot(const QString &objectName, const QString &signalSignature, const QStringList ¶meterNames); |
110 | void navigateToSlot(const QString &slotSignature); |
111 | |
112 | public Q_SLOTS: |
113 | virtual void setFeatures(Feature f) = 0; |
114 | virtual void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling) = 0; |
115 | virtual void updateProperty(const QString &name, const QVariant &value) = 0; |
116 | // Additional signals of designer property editor |
117 | virtual void resetProperty(const QString &name) = 0; |
118 | virtual void addDynamicProperty(const QString &name, const QVariant &value) = 0; |
119 | virtual void removeDynamicProperty(const QString &name) = 0; |
120 | |
121 | virtual void updateActiveFormWindow(QDesignerFormWindowInterface *formWindow) = 0; |
122 | virtual void setupFormWindow(QDesignerFormWindowInterface *formWindow) = 0; |
123 | virtual void updateSelection() = 0; |
124 | virtual void updateCustomWidgetPlugins() = 0; |
125 | |
126 | private: |
127 | QScopedPointer<QDesignerIntegrationInterfacePrivate> d; |
128 | }; |
129 | |
130 | class QDESIGNER_SDK_EXPORT QDesignerIntegration: public QDesignerIntegrationInterface |
131 | { |
132 | Q_OBJECT |
133 | public: |
134 | explicit QDesignerIntegration(QDesignerFormEditorInterface *core, QObject *parent = nullptr); |
135 | virtual ~QDesignerIntegration(); |
136 | |
137 | QString () const override; |
138 | void (const QString &) override; |
139 | |
140 | bool () const override; |
141 | void (bool ) override; |
142 | |
143 | Feature features() const override; |
144 | virtual void setFeatures(Feature f) override; |
145 | |
146 | ResourceFileWatcherBehaviour resourceFileWatcherBehaviour() const override; |
147 | void setResourceFileWatcherBehaviour(ResourceFileWatcherBehaviour behaviour) override; |
148 | |
149 | virtual QWidget *containerWindow(QWidget *widget) const override; |
150 | |
151 | // Load plugins into widget database and factory. |
152 | static void initializePlugins(QDesignerFormEditorInterface *formEditor); |
153 | |
154 | // Create a resource browser specific to integration. Language integration takes precedence |
155 | QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parent = nullptr) override; |
156 | |
157 | QString contextHelpId() const override; |
158 | |
159 | void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling) override; |
160 | void updateProperty(const QString &name, const QVariant &value) override; |
161 | // Additional signals of designer property editor |
162 | void resetProperty(const QString &name) override; |
163 | void addDynamicProperty(const QString &name, const QVariant &value) override; |
164 | void removeDynamicProperty(const QString &name) override; |
165 | |
166 | void updateActiveFormWindow(QDesignerFormWindowInterface *formWindow) override; |
167 | void setupFormWindow(QDesignerFormWindowInterface *formWindow) override; |
168 | void updateSelection() override; |
169 | void updateCustomWidgetPlugins() override; |
170 | |
171 | private: |
172 | QScopedPointer<qdesigner_internal::QDesignerIntegrationPrivate> d; |
173 | }; |
174 | |
175 | QT_END_NAMESPACE |
176 | |
177 | #endif // ABSTRACTINTEGRATION_H |
178 | |