12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
57
58
59
60
61
62
63
64
65
66
67
70
71
72
73
74
75
76
77
78
79
80
81
84
85
86
87
88
89
90
91
94
95
96
97
98
99
100
101
104
105
106
107
108
109
110
111
114
115
116
117
118
119
120
121
122
123
126
127
128
129
130
131
132
133
136
137
138
139
140
141
142
143
146
147
148
149
150
151
152
153
154
155
156
157
158
161
162
163
164
165
166
167
168
171
172
173
174
175
176
177
178
181
182
183
184
185
186
187
188
191
192
193
194
195
196
197
198
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
219
220
221
222
223
224
225
226
229
230
231
232
233
234
235
236
237
238
241
242
243
244
245
246
247
248
251
252
253
254
255
256
257
258
259
260
261
262
265
266
267
268
269
270
271
272
273
276
277
278
279
280
281
282
283
284
285
286
289
290
291
292
293
294
295
296
299
300
301
302
303
304
305
306
309
310
311
312
313
314
315
316
319
320
321
322
323
324
325
326
329
330
331
332
333
334
335
336
339
340
341
342
343
344
345
346
347
350
351
352
353
354
355
356
357
360
361
362
363
364
365
366
367
370
371
372
373
374
375
376
377
379using namespace Qt::StringLiterals;
388 return QQmlListProperty<QObject>(
this, &m_data);
397
398
399
400
401
404 if (!m_controls.contains(controlType))
406 return m_controls[controlType];
412 QList<QQStyleKitVariation *> list;
413 for (
auto *obj : children()) {
414 if (
auto *variation = qobject_cast<QQStyleKitVariation *>(obj))
415 list.append(variation);
420#define IMPLEMENT_ACCESSORS(NAME, TYPE) QQStyleKitControl
421 *QQStyleKitControls::NAME() const \
422{
423 if (!m_controls.contains(TYPE)) {
424 auto *self = const_cast<QQStyleKitControls *>(this);
425 auto *control = new QQStyleKitControl(self);
426 self->m_controls.insert(TYPE, control);
428 return m_controls[TYPE]; \
429}void
430 QQStyleKitControls::set_ ## NAME(QQStyleKitControl *control) \
431{
432 m_controls.insert(TYPE, control); \
433}
467#undef IMPLEMENT_ACCESSORS
471 for (
auto *obj : children()) {
472 if (
auto *customControl = qobject_cast<QQStyleKitCustomControl *>(obj)) {
473 const QQStyleKitExtendableControlType type = customControl->controlType();
474 const QQStyleKitExtendableControlType reserved
475 = QQStyleKitExtendableControlType(QQStyleKitReader::ControlType::Unspecified);
476 if (type >= reserved)
477 qmlWarning(
this) <<
"CustomControls must use a controlType less than " << reserved;
478 if (m_controls.contains(type))
479 qmlWarning(
this) <<
"CustomControl registered more than once: " << type;
480 m_controls.insert(type, customControl);
487#include "moc_qqstylekitcontrols_p.cpp"
void componentComplete() override
Invoked after the root component that caused this instantiation has completed construction.
const QList< QObject * > children() const
QList< QQStyleKitVariation * > variations() const
QQmlListProperty< QObject > data()
Combined button and popup list for selecting options.
#define IMPLEMENT_ACCESSORS(NAME, TYPE)