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