1 | /**************************************************************************** |
2 | ** |
3 | ** Copyright (C) 2018 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:BSD$ |
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 | ** BSD License Usage |
18 | ** Alternatively, you may use this file under the terms of the BSD license |
19 | ** as follows: |
20 | ** |
21 | ** "Redistribution and use in source and binary forms, with or without |
22 | ** modification, are permitted provided that the following conditions are |
23 | ** met: |
24 | ** * Redistributions of source code must retain the above copyright |
25 | ** notice, this list of conditions and the following disclaimer. |
26 | ** * Redistributions in binary form must reproduce the above copyright |
27 | ** notice, this list of conditions and the following disclaimer in |
28 | ** the documentation and/or other materials provided with the |
29 | ** distribution. |
30 | ** * Neither the name of The Qt Company Ltd nor the names of its |
31 | ** contributors may be used to endorse or promote products derived |
32 | ** from this software without specific prior written permission. |
33 | ** |
34 | ** |
35 | ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
36 | ** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
37 | ** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
38 | ** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
39 | ** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
40 | ** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
41 | ** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
42 | ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
43 | ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
44 | ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
45 | ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." |
46 | ** |
47 | ** $QT_END_LICENSE$ |
48 | ** |
49 | ****************************************************************************/ |
50 | |
51 | #ifndef ABSTRACTFORMBUILDERPRIVATE_H |
52 | #define ABSTRACTFORMBUILDERPRIVATE_H |
53 | |
54 | // |
55 | // W A R N I N G |
56 | // ------------- |
57 | // |
58 | // This file is not part of the Qt API. It exists purely as an |
59 | // implementation detail. This header file may change from version to |
60 | // version without notice, or even be removed. |
61 | // |
62 | // We mean it. |
63 | // |
64 | |
65 | #include "uilib_global.h" |
66 | |
67 | #include <QtCore/qhash.h> |
68 | #include <QtCore/qpointer.h> |
69 | #include <QtCore/qstringlist.h> |
70 | #include <QtCore/qmap.h> |
71 | #include <QtCore/qdir.h> |
72 | #include <QtGui/qpalette.h> |
73 | |
74 | QT_BEGIN_NAMESPACE |
75 | |
76 | class QDesignerCustomWidgetInterface; |
77 | class QObject; |
78 | class QVariant; |
79 | class QWidget; |
80 | class QObject; |
81 | class QLabel; |
82 | class QButtonGroup; |
83 | class QBoxLayout; |
84 | class QGridLayout; |
85 | class QAction; |
86 | class QActionGroup; |
87 | |
88 | #ifdef QFORMINTERNAL_NAMESPACE |
89 | namespace QFormInternal |
90 | { |
91 | #endif |
92 | |
93 | class DomBrush; |
94 | class DomButtonGroups; |
95 | class DomButtonGroup; |
96 | class DomColorGroup; |
97 | class DomCustomWidget; |
98 | class DomPalette; |
99 | class DomProperty; |
100 | class DomUI; |
101 | |
102 | class QAbstractFormBuilder; |
103 | class QResourceBuilder; |
104 | class QTextBuilder; |
105 | |
106 | class QDESIGNER_UILIB_EXPORT |
107 | { |
108 | public: |
109 | (); |
110 | (); |
111 | |
112 | struct { |
113 | (); |
114 | explicit (const DomCustomWidget *dc); |
115 | |
116 | QString ; |
117 | QString ; |
118 | QString ; |
119 | bool = false; |
120 | }; |
121 | |
122 | void (); |
123 | |
124 | DomUI *(QIODevice *dev); |
125 | static QString (); |
126 | |
127 | bool (QObject *o, const QString &propertyName, const QVariant &value); |
128 | |
129 | enum { , }; |
130 | |
131 | void () const; |
132 | static bool (const QString &buddyName, BuddyMode applyMode, QLabel *label); |
133 | |
134 | const QPointer<QWidget> &() const; |
135 | bool () const; |
136 | void (const QPointer<QWidget> &w); |
137 | |
138 | void (bool processing); |
139 | bool () const; |
140 | |
141 | void (QResourceBuilder *builder); |
142 | QResourceBuilder *() const; |
143 | |
144 | void (QTextBuilder *builder); |
145 | QTextBuilder *() const; |
146 | |
147 | void (const QString &className, const DomCustomWidget *d); |
148 | QString (const QString &className) const; |
149 | QString (const QString &className) const; |
150 | bool (const QString &className) const; |
151 | |
152 | // --- Hash used in creating button groups on demand. Store a map of name and pair of dom group and real group |
153 | void (const DomButtonGroups *groups); |
154 | |
155 | using = QPair<DomButtonGroup *, QButtonGroup*>; |
156 | using = QHash<QString, ButtonGroupEntry>; |
157 | const ButtonGroupHash &() const { return m_buttonGroups; } |
158 | ButtonGroupHash &() { return m_buttonGroups; } |
159 | |
160 | // return stretch as a comma-separated list |
161 | static QString (const QBoxLayout*); |
162 | // apply stretch |
163 | static bool (const QString &, QBoxLayout*); |
164 | static void (QBoxLayout*); |
165 | |
166 | static QString (const QGridLayout *); |
167 | static bool (const QString &, QGridLayout *); |
168 | static void (QGridLayout *); |
169 | |
170 | static QString gridLayoutColumnStretch(const QGridLayout *); |
171 | static bool setGridLayoutColumnStretch(const QString &, QGridLayout *); |
172 | static void clearGridLayoutColumnStretch(QGridLayout *); |
173 | |
174 | // return the row/column sizes as comma-separated lists |
175 | static QString (const QGridLayout *); |
176 | static bool (const QString &, QGridLayout *); |
177 | static void (QGridLayout *); |
178 | |
179 | static QString gridLayoutColumnMinimumWidth(const QGridLayout *); |
180 | static bool setGridLayoutColumnMinimumWidth(const QString &, QGridLayout *); |
181 | static void clearGridLayoutColumnMinimumWidth(QGridLayout *); |
182 | |
183 | static void (DomProperty *p, const QPair<QString, QString> &ip); |
184 | static QPalette (const DomPalette *dom); |
185 | static void (QPalette *palette, QPalette::ColorGroup colorGroup, |
186 | const DomColorGroup *group); |
187 | static DomColorGroup *(const QPalette &palette, |
188 | QPalette::ColorGroup colorGroup); |
189 | static DomPalette *(const QPalette &palette); |
190 | static QBrush (const DomBrush *brush); |
191 | static DomBrush *(const QBrush &br); |
192 | |
193 | QStringList ; |
194 | QMap<QString, QDesignerCustomWidgetInterface*> ; |
195 | |
196 | QHash<QObject*, bool> ; |
197 | QHash<QString, QAction*> ; |
198 | QHash<QString, QActionGroup*> ; |
199 | int ; |
200 | int ; |
201 | QDir ; |
202 | QString ; |
203 | QString ; |
204 | |
205 | private: |
206 | void (); |
207 | void (); |
208 | |
209 | using = QHash<QLabel*, QString>; |
210 | BuddyHash ; |
211 | |
212 | QHash<QString, CustomWidgetData> ; |
213 | |
214 | ButtonGroupHash ; |
215 | |
216 | bool = false; |
217 | QResourceBuilder * = nullptr; |
218 | QTextBuilder * = nullptr; |
219 | |
220 | QPointer<QWidget> ; |
221 | bool = false; |
222 | }; |
223 | |
224 | void uiLibWarning(const QString &message); |
225 | |
226 | // Struct with static accessor that provides most strings used in the form builder. |
227 | struct QDESIGNER_UILIB_EXPORT QFormBuilderStrings { |
228 | QFormBuilderStrings(); |
229 | |
230 | static const QFormBuilderStrings &instance(); |
231 | |
232 | const QString buddyProperty; |
233 | const QString cursorProperty; |
234 | const QString objectNameProperty; |
235 | const QString trueValue; |
236 | const QString falseValue; |
237 | const QString horizontalPostFix; |
238 | const QString separator; |
239 | const QString defaultTitle; |
240 | const QString titleAttribute; |
241 | const QString labelAttribute; |
242 | const QString toolTipAttribute; |
243 | const QString whatsThisAttribute; |
244 | const QString flagsAttribute; |
245 | const QString iconAttribute; |
246 | const QString pixmapAttribute; |
247 | const QString textAttribute; |
248 | const QString currentIndexProperty; |
249 | const QString toolBarAreaAttribute; |
250 | const QString toolBarBreakAttribute; |
251 | const QString dockWidgetAreaAttribute; |
252 | const QString marginProperty; |
253 | const QString spacingProperty; |
254 | const QString leftMarginProperty; |
255 | const QString topMarginProperty; |
256 | const QString rightMarginProperty; |
257 | const QString bottomMarginProperty; |
258 | const QString horizontalSpacingProperty; |
259 | const QString verticalSpacingProperty; |
260 | const QString sizeHintProperty; |
261 | const QString sizeTypeProperty; |
262 | const QString orientationProperty; |
263 | const QString styleSheetProperty; |
264 | const QString qtHorizontal; |
265 | const QString qtVertical; |
266 | const QString currentRowProperty; |
267 | const QString tabSpacingProperty; |
268 | const QString qWidgetClass; |
269 | const QString lineClass; |
270 | const QString geometryProperty; |
271 | const QString scriptWidgetVariable; |
272 | const QString scriptChildWidgetsVariable; |
273 | |
274 | using RoleNName = QPair<Qt::ItemDataRole, QString>; |
275 | QList<RoleNName> itemRoles; |
276 | QHash<QString, Qt::ItemDataRole> treeItemRoleHash; |
277 | |
278 | // first.first is primary role, first.second is shadow role. |
279 | // Shadow is used for either the translation source or the designer |
280 | // representation of the string value. |
281 | using TextRoleNName = QPair<QPair<Qt::ItemDataRole, Qt::ItemDataRole>, QString>; |
282 | QList<TextRoleNName> itemTextRoles; |
283 | QHash<QString, QPair<Qt::ItemDataRole, Qt::ItemDataRole> > treeItemTextRoleHash; |
284 | }; |
285 | #ifdef QFORMINTERNAL_NAMESPACE |
286 | } |
287 | #endif |
288 | |
289 | QT_END_NAMESPACE |
290 | |
291 | #endif // ABSTRACTFORMBUILDERPRIVATE_H |
292 | |