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