1 | // Copyright (C) 2020 The Qt Company Ltd. |
2 | // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only |
3 | |
4 | #ifndef ABSTRACTFORMBUILDERPRIVATE_H |
5 | #define ABSTRACTFORMBUILDERPRIVATE_H |
6 | |
7 | // |
8 | // W A R N I N G |
9 | // ------------- |
10 | // |
11 | // This file is not part of the Qt API. It exists purely as an |
12 | // implementation detail. This header file may change from version to |
13 | // version without notice, or even be removed. |
14 | // |
15 | // We mean it. |
16 | // |
17 | |
18 | #include "uilib_global.h" |
19 | |
20 | #include <QtCore/qhash.h> |
21 | #include <QtCore/qpointer.h> |
22 | #include <QtCore/qstringlist.h> |
23 | #include <QtCore/qmap.h> |
24 | #include <QtCore/qdir.h> |
25 | #include <QtGui/qpalette.h> |
26 | |
27 | QT_BEGIN_NAMESPACE |
28 | |
29 | class QDesignerCustomWidgetInterface; |
30 | class QObject; |
31 | class QVariant; |
32 | class QWidget; |
33 | class QObject; |
34 | class QLabel; |
35 | class QButtonGroup; |
36 | class QBoxLayout; |
37 | class QGridLayout; |
38 | class QAction; |
39 | class QActionGroup; |
40 | |
41 | #ifdef QFORMINTERNAL_NAMESPACE |
42 | namespace QFormInternal |
43 | { |
44 | #endif |
45 | |
46 | class DomBrush; |
47 | class DomButtonGroups; |
48 | class DomButtonGroup; |
49 | class DomColorGroup; |
50 | class DomCustomWidget; |
51 | class DomPalette; |
52 | class DomProperty; |
53 | class DomUI; |
54 | |
55 | class QAbstractFormBuilder; |
56 | class QResourceBuilder; |
57 | class QTextBuilder; |
58 | |
59 | class QDESIGNER_UILIB_EXPORT |
60 | { |
61 | public: |
62 | Q_DISABLE_COPY_MOVE(); |
63 | |
64 | (); |
65 | (); |
66 | |
67 | struct { |
68 | (); |
69 | explicit (const DomCustomWidget *dc); |
70 | |
71 | QString ; |
72 | QString ; |
73 | QString ; |
74 | bool = false; |
75 | }; |
76 | |
77 | void (); |
78 | |
79 | DomUI *(QIODevice *dev); |
80 | static QString (); |
81 | |
82 | bool (QObject *o, const QString &propertyName, const QVariant &value); |
83 | |
84 | enum { , }; |
85 | |
86 | void () const; |
87 | static bool (const QString &buddyName, BuddyMode applyMode, QLabel *label); |
88 | |
89 | const QPointer<QWidget> &() const; |
90 | bool () const; |
91 | void (const QPointer<QWidget> &w); |
92 | |
93 | void (bool processing); |
94 | bool () const; |
95 | |
96 | void (QResourceBuilder *builder); |
97 | QResourceBuilder *() const; |
98 | |
99 | void (QTextBuilder *builder); |
100 | QTextBuilder *() const; |
101 | |
102 | void (const QString &className, const DomCustomWidget *d); |
103 | QString (const QString &className) const; |
104 | QString (const QString &className) const; |
105 | bool (const QString &className) const; |
106 | |
107 | // --- Hash used in creating button groups on demand. Store a map of name and pair of dom group and real group |
108 | void (const DomButtonGroups *groups); |
109 | |
110 | using = QPair<DomButtonGroup *, QButtonGroup*>; |
111 | using = QHash<QString, ButtonGroupEntry>; |
112 | const ButtonGroupHash &() const { return m_buttonGroups; } |
113 | ButtonGroupHash &() { return m_buttonGroups; } |
114 | |
115 | // return stretch as a comma-separated list |
116 | static QString (const QBoxLayout*); |
117 | // apply stretch |
118 | static bool (const QString &, QBoxLayout*); |
119 | static void (QBoxLayout*); |
120 | |
121 | static QString (const QGridLayout *); |
122 | static bool (const QString &, QGridLayout *); |
123 | static void (QGridLayout *); |
124 | |
125 | static QString gridLayoutColumnStretch(const QGridLayout *); |
126 | static bool setGridLayoutColumnStretch(const QString &, QGridLayout *); |
127 | static void clearGridLayoutColumnStretch(QGridLayout *); |
128 | |
129 | // return the row/column sizes as comma-separated lists |
130 | static QString (const QGridLayout *); |
131 | static bool (const QString &, QGridLayout *); |
132 | static void (QGridLayout *); |
133 | |
134 | static QString gridLayoutColumnMinimumWidth(const QGridLayout *); |
135 | static bool setGridLayoutColumnMinimumWidth(const QString &, QGridLayout *); |
136 | static void clearGridLayoutColumnMinimumWidth(QGridLayout *); |
137 | |
138 | static void (DomProperty *p, const QPair<QString, QString> &ip); |
139 | static QPalette (const DomPalette *dom); |
140 | static void (QPalette *palette, QPalette::ColorGroup colorGroup, |
141 | const DomColorGroup *group); |
142 | static DomColorGroup *(const QPalette &palette, |
143 | QPalette::ColorGroup colorGroup); |
144 | static DomPalette *(const QPalette &palette); |
145 | static QBrush (const DomBrush *brush); |
146 | static DomBrush *(const QBrush &br); |
147 | |
148 | QStringList ; |
149 | QMap<QString, QDesignerCustomWidgetInterface*> ; |
150 | |
151 | QHash<QObject*, bool> ; |
152 | QHash<QString, QAction*> ; |
153 | QHash<QString, QActionGroup*> ; |
154 | int ; |
155 | int ; |
156 | QDir ; |
157 | QString ; |
158 | QString ; |
159 | |
160 | private: |
161 | void (); |
162 | void (); |
163 | |
164 | QHash<QLabel *, QString> ; |
165 | |
166 | QHash<QString, CustomWidgetData> ; |
167 | |
168 | ButtonGroupHash ; |
169 | |
170 | bool = false; |
171 | QResourceBuilder * = nullptr; |
172 | QTextBuilder * = nullptr; |
173 | |
174 | QPointer<QWidget> ; |
175 | bool = false; |
176 | }; |
177 | |
178 | void uiLibWarning(const QString &message); |
179 | |
180 | // Struct with static accessor that provides most strings used in the form builder. |
181 | struct QDESIGNER_UILIB_EXPORT QFormBuilderStrings { |
182 | QFormBuilderStrings(); |
183 | |
184 | static const QFormBuilderStrings &instance(); |
185 | |
186 | const QString buddyProperty; |
187 | const QString cursorProperty; |
188 | const QString objectNameProperty; |
189 | const QString trueValue; |
190 | const QString falseValue; |
191 | const QString horizontalPostFix; |
192 | const QString separator; |
193 | const QString defaultTitle; |
194 | const QString titleAttribute; |
195 | const QString labelAttribute; |
196 | const QString toolTipAttribute; |
197 | const QString whatsThisAttribute; |
198 | const QString flagsAttribute; |
199 | const QString iconAttribute; |
200 | const QString pixmapAttribute; |
201 | const QString textAttribute; |
202 | const QString currentIndexProperty; |
203 | const QString toolBarAreaAttribute; |
204 | const QString toolBarBreakAttribute; |
205 | const QString dockWidgetAreaAttribute; |
206 | const QString marginProperty; |
207 | const QString spacingProperty; |
208 | const QString leftMarginProperty; |
209 | const QString topMarginProperty; |
210 | const QString rightMarginProperty; |
211 | const QString bottomMarginProperty; |
212 | const QString horizontalSpacingProperty; |
213 | const QString verticalSpacingProperty; |
214 | const QString sizeHintProperty; |
215 | const QString sizeTypeProperty; |
216 | const QString orientationProperty; |
217 | const QString styleSheetProperty; |
218 | const QString qtHorizontal; |
219 | const QString qtVertical; |
220 | const QString currentRowProperty; |
221 | const QString tabSpacingProperty; |
222 | const QString qWidgetClass; |
223 | const QString lineClass; |
224 | const QString geometryProperty; |
225 | const QString scriptWidgetVariable; |
226 | const QString scriptChildWidgetsVariable; |
227 | |
228 | using RoleNName = QPair<Qt::ItemDataRole, QString>; |
229 | QList<RoleNName> itemRoles; |
230 | QHash<QString, Qt::ItemDataRole> treeItemRoleHash; |
231 | |
232 | // first.first is primary role, first.second is shadow role. |
233 | // Shadow is used for either the translation source or the designer |
234 | // representation of the string value. |
235 | using TextRoleNName = QPair<QPair<Qt::ItemDataRole, Qt::ItemDataRole>, QString>; |
236 | QList<TextRoleNName> itemTextRoles; |
237 | QHash<QString, QPair<Qt::ItemDataRole, Qt::ItemDataRole> > treeItemTextRoleHash; |
238 | }; |
239 | #ifdef QFORMINTERNAL_NAMESPACE |
240 | } |
241 | #endif |
242 | |
243 | QT_END_NAMESPACE |
244 | |
245 | #endif // ABSTRACTFORMBUILDERPRIVATE_H |
246 | |