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
abstractintegration.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#ifndef ABSTRACTINTEGRATION_H
6#define ABSTRACTINTEGRATION_H
7
8#include <QtDesigner/sdk_global.h>
9
10#include <QtCore/qobject.h>
11#include <QtCore/qstringlist.h>
12#include <QtCore/qflags.h>
13#include <QtCore/qversionnumber.h>
14
15#include <memory>
16
17QT_BEGIN_NAMESPACE
18
19class QDesignerFormWindowInterface;
20class QDesignerFormEditorInterface;
22class QDesignerResourceBrowserInterface;
23class QVariant;
24class QWidget;
25
26namespace qdesigner_internal {
28}
29
30class QDESIGNER_SDK_EXPORT QDesignerIntegrationInterface: public QObject
31{
32 Q_OBJECT
33 Q_PROPERTY(QString headerSuffix READ headerSuffix WRITE setHeaderSuffix)
34 Q_PROPERTY(bool headerLowercase READ isHeaderLowercase WRITE setHeaderLowercase)
35 Q_PROPERTY(QVersionNumber qtVersion READ qtVersion WRITE setQtVersion)
36
37public:
38 enum ResourceFileWatcherBehaviour
39 {
40 NoResourceFileWatcher,
41 ReloadResourceFileSilently,
42 PromptToReloadResourceFile // Default
43 };
44 Q_ENUM(ResourceFileWatcherBehaviour)
45
46 enum FeatureFlag
47 {
48 ResourceEditorFeature = 0x1,
49 SlotNavigationFeature = 0x2,
50 DefaultWidgetActionFeature = 0x4,
51 DefaultFeature = ResourceEditorFeature | DefaultWidgetActionFeature
52 };
53 Q_DECLARE_FLAGS(Feature, FeatureFlag)
54
55 explicit QDesignerIntegrationInterface(QDesignerFormEditorInterface *core, QObject *parent = nullptr);
56 ~QDesignerIntegrationInterface() override;
57
58 QDesignerFormEditorInterface *core() const;
59
60 virtual QWidget *containerWindow(QWidget *widget) const = 0;
61
62 // Create a resource browser specific to integration. Language integration takes precedence
63 virtual QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parent = nullptr) = 0;
64 virtual QString headerSuffix() const = 0;
65 virtual void setHeaderSuffix(const QString &headerSuffix) = 0;
66
67 virtual bool isHeaderLowercase() const = 0;
68 virtual void setHeaderLowercase(bool headerLowerCase) = 0;
69
70 QVersionNumber qtVersion() const;
71 void setQtVersion(const QVersionNumber &qtVersion);
72
73 virtual Feature features() const = 0;
74 bool hasFeature(Feature f) const;
75
76 virtual ResourceFileWatcherBehaviour resourceFileWatcherBehaviour() const = 0;
77 virtual void setResourceFileWatcherBehaviour(ResourceFileWatcherBehaviour behaviour) = 0;
78
79 virtual QString contextHelpId() const = 0;
80
81 void emitObjectNameChanged(QDesignerFormWindowInterface *formWindow, QObject *object,
82 const QString &newName, const QString &oldName);
83 void emitNavigateToSlot(const QString &objectName, const QString &signalSignature, const QStringList &parameterNames);
84 void emitNavigateToSlot(const QString &slotSignature);
85 void emitHelpRequested(const QString &manual, const QString &document);
86
87Q_SIGNALS:
88 void propertyChanged(QDesignerFormWindowInterface *formWindow, const QString &name, const QVariant &value);
89 void objectNameChanged(QDesignerFormWindowInterface *formWindow, QObject *object, const QString &newName, const QString &oldName);
90 void helpRequested(const QString &manual, const QString &document);
91
92 void navigateToSlot(const QString &objectName, const QString &signalSignature, const QStringList &parameterNames);
93 void navigateToSlot(const QString &slotSignature);
94
95public Q_SLOTS:
96 virtual void setFeatures(Feature f) = 0;
97 virtual void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling) = 0;
98 virtual void updateProperty(const QString &name, const QVariant &value) = 0;
99 // Additional signals of designer property editor
100 virtual void resetProperty(const QString &name) = 0;
101 virtual void addDynamicProperty(const QString &name, const QVariant &value) = 0;
102 virtual void removeDynamicProperty(const QString &name) = 0;
103
104 virtual void updateActiveFormWindow(QDesignerFormWindowInterface *formWindow) = 0;
105 virtual void setupFormWindow(QDesignerFormWindowInterface *formWindow) = 0;
106 virtual void updateSelection() = 0;
107 virtual void updateCustomWidgetPlugins() = 0;
108
109private:
110 std::unique_ptr<QDesignerIntegrationInterfacePrivate> d;
111};
112
113class QDESIGNER_SDK_EXPORT QDesignerIntegration: public QDesignerIntegrationInterface
114{
115 Q_OBJECT
116public:
117 explicit QDesignerIntegration(QDesignerFormEditorInterface *core, QObject *parent = nullptr);
118 ~QDesignerIntegration() override;
119
120 QString headerSuffix() const override;
121 void setHeaderSuffix(const QString &headerSuffix) override;
122
123 bool isHeaderLowercase() const override;
124 void setHeaderLowercase(bool headerLowerCase) override;
125
126 Feature features() const override;
127 void setFeatures(Feature f) override;
128
129 ResourceFileWatcherBehaviour resourceFileWatcherBehaviour() const override;
130 void setResourceFileWatcherBehaviour(ResourceFileWatcherBehaviour behaviour) override;
131
132 QWidget *containerWindow(QWidget *widget) const override;
133
134 // Load plugins into widget database and factory.
135 static void initializePlugins(QDesignerFormEditorInterface *formEditor);
136
137 // Create a resource browser specific to integration. Language integration takes precedence
138 QDesignerResourceBrowserInterface *createResourceBrowser(QWidget *parent = nullptr) override;
139
140 QString contextHelpId() const override;
141
142 void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling) override;
143 void updateProperty(const QString &name, const QVariant &value) override;
144 // Additional signals of designer property editor
145 void resetProperty(const QString &name) override;
146 void addDynamicProperty(const QString &name, const QVariant &value) override;
147 void removeDynamicProperty(const QString &name) override;
148
149 void updateActiveFormWindow(QDesignerFormWindowInterface *formWindow) override;
150 void setupFormWindow(QDesignerFormWindowInterface *formWindow) override;
151 void updateSelection() override;
152 void updateCustomWidgetPlugins() override;
153
154private:
155 std::unique_ptr<qdesigner_internal::QDesignerIntegrationPrivate> d;
156};
157
158QT_END_NAMESPACE
159
160#endif // ABSTRACTINTEGRATION_H
QDesignerIntegrationInterfacePrivate(QDesignerFormEditorInterface *core)
QDesignerFormEditorInterface * m_core
The QDesignerIntegrationInterface glues together parts of \QD and allows for overwriting functionalit...
The QDesignerIntegration class is \QD's implementation of QDesignerIntegrationInterface.
virtual QString propertyGroup(int index) const =0
virtual int indexOf(const QString &name) const =0
friend class QWidget
Definition qpainter.h:432
static void restoreState(QtGradientManager *manager, const QString &state)
void getSelection(qdesigner_internal::Selection &s)
static void initializePlugins(QDesignerFormEditorInterface *formEditor)
QDesignerIntegrationInterface::Feature m_features
void setupFormWindow(QDesignerFormWindowInterface *formWindow)
void addDynamicProperty(const QString &name, const QVariant &value)
void updateProperty(const QString &name, const QVariant &value, bool enableSubPropertyHandling)
QDesignerIntegrationInterface::ResourceFileWatcherBehaviour m_resourceFileWatcherBehaviour
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
static QString fixHelpClassName(const QString &className)
static QString classForProperty(QDesignerFormEditorInterface *core, QObject *object, const QString &property)