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
qqstylekitcontrols.cpp
Go to the documentation of this file.
1// Copyright (C) 2025 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
7
9
10/*!
11 \qmltype StylableControls
12 \inqmlmodule Qt.labs.StyleKit
13 \brief Abstract base type containing the control types that can be styled.
14
15 StylableControls is an abstract base type. It contains a \l ControlStyle for
16 each control type that can be styled by a \l Style, \l Theme, or \l StyleVariation.
17
18 The control types form a hierarchy where properties set on a base type
19 propagate down to the more specific ones. For example, assigning a radius
20 of four to \c abstractButton.background.radius will cause all button
21 types, such as \l button, \l checkBox, and \l radioButton, to get a radius
22 of four.
23
24 The snippets on this page illustrate a few of the key properties that can be
25 used to style each control type, but they are by no means exhaustive. Many other properties
26 are available, as documented in the \l ControlStyle and \l DelegateStyle documentation.
27 In practice, some of them can also be omitted because the
28 \l {Style::fallbackStyle}{fallback style} already supplies sensible defaults.
29 This means that if you simply remove a property from one of the snippets, it
30 might not actually affect its appearance, since it will just be read from the
31 fallback style instead.
32
33 \sa {StyleKit Property Resolution}
34
35 \labs
36*/
37
38/*!
39 \qmlproperty ControlStyle StylableControls::control
40
41 Grouped property for styling all controls.
42
43 \c control is the base type in the control hierarchy, and properties set here
44 serve as defaults for all other control types. For example, setting
45 \c{control.width: 200} makes \e all controls 200 pixels wide,
46 including buttons, scroll indicators and every other control.
47 It also overrides any values inherited from a higher level in the style
48 hierarchy (the \l Style for a \l Theme, or the
49 \l {Style::fallbackStyle}{fallbackStyle} for a \l Style), \e including hover
50 effects and other state-based behavior. Use \c{control} sparingly, and
51 prefer more specific base types like \l abstractButton or \l pane when
52 possible.
53
54 \snippet ControlsSnippets.qml control
55*/
56
57/*!
58 \qmlproperty ControlStyle StylableControls::abstractButton
59
60 Grouped property for styling all button-like controls, including
61 \l [QtQuickControls]{Button}, \l [QtQuickControls]{CheckBox},
62 \l [QtQuickControls]{RadioButton}, \l [QtQuickControls]{Switch}
63 and \l [QtQuickControls]{RoundButton}.
64 Unset properties fall back to \l control.
65
66 \snippet ControlsSnippets.qml abstractButton
67
68 \sa {Qt Labs StyleKit}{Control Types}
69*/
70
71/*!
72 \qmlproperty ControlStyle StylableControls::applicationWindow
73
74 Grouped property for styling \l [QtQuickControls] ApplicationWindow.
75
76 Unset properties fall back to \l control.
77
78 Use \c applicationWindow to set the background color of the window:
79
80 \snippet ControlsSnippets.qml applicationWindow
81
82 \note The application needs to use ApplicationWindow, not Window, for this to take effect.
83*/
84
85/*!
86 \qmlproperty ControlStyle StylableControls::busyIndicator
87
88 Grouped property for styling \l [QtQuickControls]{BusyIndicator}.
89
90 Unset properties fall back to \l control.
91
92 \snippet ControlsSnippets.qml busyIndicator
93
94 StyleKit doesn't provide dedicated properties to style the animation of the
95 spinning indicator. To change the shape or animation of the spinning indicator,
96 you need to implement a custom indicator foreground \l {DelegateStyle::}{delegate}
97 instead:
98
99 \snippet ControlsSnippets.qml busyIndicator delegate
100*/
101
102/*!
103 \qmlproperty ControlStyle StylableControls::button
104
105 Grouped property for styling \l [QtQuickControls]{Button}.
106
107 Unset properties fall back to \l abstractButton.
108
109 \snippet ControlsSnippets.qml button
110*/
111
112/*!
113 \qmlproperty ControlStyle StylableControls::checkBox
114
115 Grouped property for styling \l [QtQuickControls]{CheckBox}.
116
117 Unset properties fall back to \l abstractButton.
118
119 \snippet ControlsSnippets.qml checkBox
120*/
121
122/*!
123 \qmlproperty ControlStyle StylableControls::checkDelegate
124
125 Grouped property for styling \l [QtQuickControls]{CheckDelegate}.
126
127 Unset properties fall back to \l itemDelegate.
128
129 \snippet ControlsSnippets.qml checkDelegate
130*/
131
132/*!
133 \qmlproperty ControlStyle StylableControls::comboBox
134
135 Grouped property for styling \l [QtQuickControls]{ComboBox}.
136
137 Unset properties fall back to \l control.
138
139 \note Style the popup through \l popup, and its items through \l itemDelegate.
140
141 \snippet ControlsSnippets.qml comboBox
142*/
143
144/*!
145 \qmlproperty ControlStyle StylableControls::delayButton
146
147 Grouped property for styling \l [QtQuickControls]{DelayButton}.
148
149 For a delay button, the progress is styled through the indicator. By
150 default, the indicator is drawn as a thin bar along the bottom edge of
151 the button, and its foreground fills up as the progress increases.
152
153 Unset properties fall back to \l abstractButton.
154
155 \snippet ControlsSnippets.qml delayButton
156*/
157
158/*!
159 \qmlproperty ControlStyle StylableControls::dial
160
161 Grouped property for styling \l [QtQuickControls]{Dial}.
162
163 Unset properties fall back to \l control.
164
165 \snippet ControlsSnippets.qml dial
166*/
167
168/*!
169 \qmlproperty ControlStyle StylableControls::dialog
170
171 Grouped property for styling \l [QtQuickControls]{Dialog}.
172
173 Unset properties fall back to \l popup.
174
175 \snippet ControlsSnippets.qml dialog
176*/
177
178/*!
179 \qmlproperty ControlStyle StylableControls::dialogButtonBox
180
181 Grouped property for styling \l [QtQuickControls]{DialogButtonBox}.
182
183 Unset properties fall back to \l pane.
184
185 \snippet ControlsSnippets.qml dialogButtonBox
186*/
187
188/*!
189 \qmlproperty ControlStyle StylableControls::drawer
190
191 Grouped property for styling \l [QtQuickControls]{Drawer}.
192
193 Unset properties fall back to \l popup.
194
195 \snippet ControlsSnippets.qml drawer
196*/
197
198/*!
199 \qmlproperty ControlStyle StylableControls::flatButton
200
201 Grouped property for styling flat buttons (buttons with no visible
202 background in their normal state). The styling will take effect for
203 a \l [QtQuickControls]{Button} if \l [QtQuickControls]{Button::flat}{Button.flat} is set to \c true.
204
205 Unset properties fall back to \l abstractButton.
206
207 \snippet ControlsSnippets.qml flatButton
208*/
209
210/*!
211 \qmlproperty ControlStyle StylableControls::frame
212
213 Grouped property for styling \l [QtQuickControls]{Frame}.
214
215 Unset properties fall back to \l pane.
216
217 \snippet ControlsSnippets.qml frame
218*/
219
220/*!
221 \qmlproperty ControlStyle StylableControls::groupBox
222
223 Grouped property for styling \l [QtQuickControls]{GroupBox}.
224
225 Unset properties fall back to \l frame.
226
227 \snippet ControlsSnippets.qml groupBox
228*/
229
230/*!
231 \qmlproperty ControlStyle StylableControls::horizontalHeaderViewDelegate
232
233 Grouped property for styling \l [QtQuickControls]{HorizontalHeaderViewDelegate}.
234
235 For a horizontal header view delegate, the sort indicator is styled through
236 the indicator. \l {IndicatorStyle::first}{indicator.first} is shown when the
237 column is sorted in ascending order, and \l {IndicatorStyle::second}{indicator.second}
238 when it is sorted in descending order. Only one of them is visible at a
239 time, and only on the header of the column the view is currently sorted by.
240
241 Unset properties fall back to \l tableViewDelegate.
242
243 \snippet ControlsSnippets.qml horizontalHeaderViewDelegate
244*/
245
246/*!
247 \qmlproperty ControlStyle StylableControls::itemDelegate
248
249 Grouped property for styling \l [QtQuickControls]{ItemDelegate}.
250
251 Unset properties fall back to \l control.
252
253 \note In Qt Quick Controls, \l [QtQuickControls]{ItemDelegate} inherits from
254 \l [QtQuickControls]{AbstractButton}. In StyleKit, however, \c itemDelegate
255 falls back to \l control rather than \l abstractButton, since delegates are
256 typically \e styled very differently from buttons (flat, no borders or drop shadows, etc.).
257
258 \snippet ControlsSnippets.qml itemDelegate
259*/
260
261/*!
262 \qmlproperty ControlStyle StylableControls::label
263
264 Grouped property for styling \l [QtQuickControls]{Label}.
265
266 Unset properties fall back to \l control.
267
268 \snippet ControlsSnippets.qml label
269*/
270
271/*!
272 \qmlproperty ControlStyle StylableControls::menu
273
274 Grouped property for styling \l [QtQuickControls]{Menu}.
275
276 Unset properties fall back to \l popup.
277
278 \snippet ControlsSnippets.qml menu
279*/
280
281/*!
282 \qmlproperty ControlStyle StylableControls::menuItem
283
284 Grouped property for styling \l [QtQuickControls]{MenuItem}.
285
286 Unset properties fall back to \l control.
287
288 \note In Qt Quick Controls, a \l [QtQuickControls]{MenuItem} inherits from
289    \l [QtQuickControls]{AbstractButton}. In StyleKit, however, \c menuItem
290 falls back to \l control instead of \l abstractButton, since menu items are
291 typically \e styled very differently from regular buttons
292 (flat, no borders or drop shadows, etc.).
293
294 \snippet ControlsSnippets.qml menuItem
295*/
296
297/*!
298 \qmlproperty ControlStyle StylableControls::menuBar
299
300 Grouped property for styling \l [QtQuickControls]{MenuBar}.
301
302 Unset properties fall back to \l control.
303
304 \note Styling \l [QtQuickControls]{MenuBar}, \l [QtQuickControls]{MenuBarItem},
305 and \l [QtQuickControls]{MenuSeparator} normally only affects non-native
306 menu bars. When a MenuBar is implemented as a native menu bar, its delegates
307 are not used for rendering, so StyleKit style properties may have no visual
308 effect. See \l [QtLabsPlatform]{MenuBar} {Native Menu Bars} for details.
309
310 \snippet ControlsSnippets.qml menuBar
311*/
312
313/*!
314 \qmlproperty ControlStyle StylableControls::menuBarItem
315
316 Grouped property for styling menu items in a \l [QtQuickControls]{MenuBar}.
317
318 Unset properties fall back to \l control.
319
320 \note In Qt Quick Controls, a \l [QtQuickControls]{MenuBarItem} inherits from
321 \l [QtQuickControls]{AbstractButton}. In StyleKit, however, \c menuBarItem is a
322 separate control type that falls back to \l control instead of \l abstractButton,
323 since menu bar items are typically styled very differently from regular buttons
324 (flat, no borders or drop shadows, etc.).
325
326 \snippet ControlsSnippets.qml menuBarItem
327*/
328
329/*!
330 \qmlproperty ControlStyle StylableControls::menuSeparator
331
332 Grouped property for styling \l [QtQuickControls]{MenuSeparator}.
333
334 Unset properties fall back to \l control.
335
336 \snippet ControlsSnippets.qml menuSeparator
337*/
338
339/*!
340 \qmlproperty ControlStyle StylableControls::page
341
342 Grouped property for styling \l [QtQuickControls]{Page}.
343
344 Unset properties fall back to \l pane.
345
346 Note that the \l [QtQuickControls]{Page::header}{header} and
347 \l [QtQuickControls]{Page::footer}{footer} of a \l [QtQuickControls]{Page} are
348 typically set by the application to a \l [QtQuickControls]{ToolBar} or
349 \l [QtQuickControls]{TabBar}, and those controls are styled separately.
350 To give a \l [QtQuickControls]{ToolBar} alternative styling when used inside
351 a \l [QtQuickControls]{Page}, use a \l StyleVariation:
352
353 \snippet ControlsSnippets.qml page
354*/
355
356/*!
357 \qmlproperty ControlStyle StylableControls::pageIndicator
358
359 Grouped property for styling \l [QtQuickControls]{PageIndicator}.
360
361 Unset properties fall back to \l control.
362
363 \snippet ControlsSnippets.qml pageIndicator
364*/
365
366/*!
367 \qmlproperty ControlStyle StylableControls::pane
368
369 Grouped property for styling \l [QtQuickControls]{Pane}.
370
371 Unset properties fall back to \l control.
372
373 \snippet ControlsSnippets.qml pane
374*/
375
376/*!
377 \qmlproperty ControlStyle StylableControls::popup
378
379 Grouped property for styling \l [QtQuickControls]{Popup}.
380
381 Unset properties fall back to \l control.
382
383 \snippet ControlsSnippets.qml popup
384*/
385
386/*!
387 \qmlproperty ControlStyle StylableControls::progressBar
388
389 Grouped property for styling \l [QtQuickControls]{ProgressBar}.
390 For a progress bar, the groove is styled through the indicator, while the progress
391 track is styled through the indicator's foreground.
392
393 Unset properties fall back to \l control.
394
395 \snippet ControlsSnippets.qml progressBar
396
397 StyleKit doesn't provide a dedicated property to style the indeterminate animation
398 of a progress bar. To change the animation, you need to implement a custom indicator
399 foreground \l {DelegateStyle::}{delegate} instead:
400
401 \snippet ControlsSnippets.qml progressBar indeterminate
402*/
403
404/*!
405 \qmlproperty ControlStyle StylableControls::radioButton
406
407 Grouped property for styling \l [QtQuickControls]{RadioButton}.
408
409 Unset properties fall back to \l abstractButton.
410
411 \snippet ControlsSnippets.qml radioButton
412*/
413
414/*!
415 \qmlproperty ControlStyle StylableControls::radioDelegate
416
417 Grouped property for styling \l [QtQuickControls]{RadioDelegate}.
418
419 Unset properties fall back to \l itemDelegate.
420
421 \snippet ControlsSnippets.qml radioDelegate
422*/
423
424/*!
425 \qmlproperty ControlStyle StylableControls::roundButton
426
427 Grouped property for styling \l [QtQuickControls]{RoundButton}.
428
429 Unset properties fall back to \l abstractButton.
430
431 \snippet ControlsSnippets.qml roundButton
432*/
433
434/*!
435 \qmlproperty ControlStyle StylableControls::scrollBar
436
437 Grouped property for styling \l [QtQuickControls]{ScrollBar}.
438 The groove is styled through \l {ControlStyleProperties::}{background}, and the
439 handle through \l {ControlStyleProperties::}{indicator}.
440
441 Unset properties fall back to \l control.
442
443 \snippet ControlsSnippets.qml scrollBar
444*/
445
446/*!
447 \qmlproperty ControlStyle StylableControls::scrollIndicator
448
449 Grouped property for styling \l [QtQuickControls]{ScrollIndicator}.
450 The groove is styled through \l {ControlStyleProperties::}{background}, and the
451 handle through \l {ControlStyleProperties::}{indicator}.
452
453 Unset properties fall back to \l control.
454
455 \snippet ControlsSnippets.qml scrollIndicator
456*/
457
458/*!
459 \qmlproperty ControlStyle StylableControls::scrollView
460
461 Grouped property for styling \l [QtQuickControls]{ScrollView}.
462
463 ScrollView itself has no visual delegates to style. Its scroll bars can be
464 styled separately through the \l scrollBar property. But you can use
465 \l {ControlStateStyle::padding}{padding} to control the space between
466 the scroll bars and the content area.
467
468 Unset properties fall back to \l control.
469
470 \snippet ControlsSnippets.qml scrollView
471*/
472
473/*!
474 \qmlproperty ControlStyle StylableControls::searchField
475
476 Grouped property for styling \l [QtQuickControls]{SearchField}.
477
478 Unset properties fall back to \l control.
479
480 \snippet ControlsSnippets.qml searchField
481
482*/
483
484/*!
485 \qmlproperty ControlStyle StylableControls::slider
486
487 Grouped property for styling \l [QtQuickControls]{Slider}.
488 For a slider, the groove is styled through the indicator, while the progress
489 track is styled through the indicator's foreground.
490
491 Unset properties fall back to \l control.
492
493 For vertical sliders, swap the \l {DelegateStyle::width}{width}
494 and \l {DelegateStyle::height}{height} of the relevant delegates
495 so that the control is taller than it is wide, as shown in the snippet below.
496
497 \snippet ControlsSnippets.qml slider
498*/
499
500/*!
501 \qmlproperty ControlStyle StylableControls::spinBox
502
503 Grouped property for styling \l [QtQuickControls]{SpinBox}.
504
505 Unset properties fall back to \l control.
506
507 \snippet ControlsSnippets.qml spinBox
508
509 \note It's currently only possible to position the up and down buttons to
510 be on the left or right side of the control, but not on top of each other.
511*/
512
513/*!
514 \qmlproperty ControlStyle StylableControls::swipeDelegate
515
516 Grouped property for styling \l [QtQuickControls]{SwipeDelegate}.
517
518 Unset properties fall back to \l itemDelegate.
519
520 \snippet ControlsSnippets.qml swipeDelegate
521*/
522
523/*!
524 \qmlproperty ControlStyle StylableControls::switchControl
525
526 Grouped property for styling \l [QtQuickControls]{Switch}.
527
528 Unset properties fall back to \l abstractButton.
529
530 \snippet ControlsSnippets.qml switchControl
531*/
532
533/*!
534 \qmlproperty ControlStyle StylableControls::switchDelegate
535
536 Grouped property for styling \l [QtQuickControls]{SwitchDelegate}.
537
538 Unset properties fall back to \l itemDelegate.
539
540 \snippet ControlsSnippets.qml switchDelegate
541*/
542
543/*!
544 \qmlproperty ControlStyle StylableControls::tabBar
545
546 Grouped property for styling \l [QtQuickControls]{TabBar}.
547
548 Unset properties fall back to \l pane.
549
550 \snippet ControlsSnippets.qml tabBar
551*/
552
553/*!
554 \qmlproperty ControlStyle StylableControls::tabButton
555
556 Grouped property for styling \l [QtQuickControls]{TabButton}.
557
558 Unset properties fall back to \l abstractButton.
559
560 \snippet ControlsSnippets.qml tabButton
561*/
562
563/*
564 \qmlproperty ControlStyle StylableControls::tableViewDelegate
565
566 Grouped property for styling \l [QtQuickControls]{TableViewDelegate}.
567
568 Unset properties fall back to \l itemDelegate.
569
570 \snippet ControlsSnippets.qml tableViewDelegate
571*/
572
573/*!
574 \qmlproperty ControlStyle StylableControls::textArea
575
576 Grouped property for styling \l [QtQuickControls]{TextArea}.
577
578 Unset properties fall back to \l textInput.
579
580 \snippet ControlsSnippets.qml textArea
581*/
582
583/*!
584 \qmlproperty ControlStyle StylableControls::textField
585
586 Grouped property for styling \l [QtQuickControls]{TextField}.
587
588 Unset properties fall back to \l textInput.
589
590 \snippet ControlsSnippets.qml textField
591*/
592
593/*!
594 \qmlproperty ControlStyle StylableControls::textInput
595
596 Grouped property for styling all text input controls, including
597 \l [QtQuickControls]{TextField} and \l [QtQuickControls]{TextArea}.
598
599 Unset properties fall back to \l control.
600
601 \snippet ControlsSnippets.qml textInput
602*/
603
604/*!
605 \qmlproperty ControlStyle StylableControls::toolBar
606
607 Grouped property for styling \l [QtQuickControls]{ToolBar}.
608
609 Unset properties fall back to \l pane.
610
611 \snippet ControlsSnippets.qml toolBar
612*/
613
614/*!
615 \qmlproperty ControlStyle StylableControls::toolButton
616
617 Grouped property for styling \l [QtQuickControls]{ToolButton}.
618
619 Unset properties fall back to \l abstractButton.
620
621 \snippet ControlsSnippets.qml toolButton
622*/
623
624/*!
625 \qmlproperty ControlStyle StylableControls::toolSeparator
626
627 Grouped property for styling \l [QtQuickControls]{ToolSeparator}.
628
629 Unset properties fall back to \l control.
630
631 For vertical separators, swap the \l {DelegateStyle::width}{width}
632 and \l {DelegateStyle::height}{height} of the relevant delegates
633 so that the control is taller than it is wide, as shown in the snippet below.
634
635 \snippet ControlsSnippets.qml toolSeparator
636*/
637
638/*!
639 \qmlproperty ControlStyle StylableControls::toolTip
640
641 Grouped property for styling \l [QtQuickControls]{ToolTip}.
642
643 Unset properties fall back to \l popup.
644
645 \snippet ControlsSnippets.qml toolTip
646*/
647
648/*!
649 \qmlproperty ControlStyle StylableControls::treeViewDelegate
650
651 Grouped property for styling \l [QtQuickControls]{TreeViewDelegate}.
652
653 Unset properties fall back to \l itemDelegate.
654
655 \snippet ControlsSnippets.qml treeViewDelegate
656*/
657
658/*!
659 \qmlproperty ControlStyle StylableControls::tumbler
660
661 Grouped property for styling \l [QtQuickControls]{Tumbler}.
662
663 Unset properties fall back to \l control.
664
665 \snippet ControlsSnippets.qml tumbler
666*/
667
668/*
669 \qmlproperty ControlStyle StylableControls::verticalHeaderViewDelegate
670
671 Grouped property for styling \l [QtQuickControls]{VerticalHeaderViewDelegate}.
672
673 Unset properties fall back to \l tableViewDelegate.
674
675 \snippet ControlsSnippets.qml verticalHeaderViewDelegate
676*/
677
678using namespace Qt::StringLiterals;
679
680QQStyleKitControls::QQStyleKitControls(QObject *parent)
681 : QObject(parent)
682{
683}
684
686{
687 return QQmlListProperty<QObject>(this, &m_data);
688}
689
691{
692 return m_data;
693}
694
695/*!
696 \qmlmethod ControlStyle StylableControls::getControlStyle(controlType)
697
698 Returns the \l ControlStyle for the given \a controlType, or \c null, if
699 no \l ControlStyle for the type has been defined.
700
701 \a controlType can be one of the built-in types documented by
702 \l {StyleReader::controlType}{StyleReader.controlType}, or the
703 \l {CustomControl::controlType}{controlType} of a \l CustomControl.
704
705 This function can be used to, for example, read or write a property on
706 a \l CustomControl's style at runtime:
707
708 \snippet ControlsSnippets.qml getControlStyle
709
710 \snippet ControlsSnippets.qml getControlStyle-function
711
712 If \a controlType is a built-in type (such as \c {StyleReader.Button}),
713 using for example \c {myStyle.button} or \c {myStyle.getControlStyle(StyleReader.Button)}
714 to get the \l ControlStyle is \e almost equivalent.
715 The difference is that the former will lazily create a \l ControlStyle if
716 it's not yet defined, while the latter will instead return \c null.
717 This means that for example \c {myStyle.button.padding = 10} is always
718 safe, while \c {myStyle.getControlStyle(StyleReader.Button).padding = 10} will
719 fail if \c {myStyle.button} has not been defined in the \l Style.
720
721 \sa CustomControl, StyleReader
722*/
723
724/* Lazy-create the controls that the style is actually using, when accessed
725 * from the style/application (e.g from Style or Theme). We don't lazy
726 * create any controls while resolving style properties, as undefined controls would
727 * anyway not contain any property overrides. The properties have setters too, to
728 * allow the style/application to share custom ControlStyle the classical
729 * way, e.g button: ControlStyle { id: button }. */
730QQStyleKitControl* QQStyleKitControls::getControlStyle(QQStyleKitExtendableControlType controlType) const
731{
732 return m_controls.value(controlType, nullptr);
733}
734
735#define IMPLEMENT_ACCESSORS(NAME, TYPE) QQStyleKitControl
736 *QQStyleKitControls::NAME() const \
737{
738 if (!m_controls.contains(TYPE)) {
739 auto *self = const_cast<QQStyleKitControls *>(this);
740 auto *control = new QQStyleKitControl(self);
741 self->m_controls.insert(TYPE, control);
742 }
743 return m_controls[TYPE]; \
744}void
745 QQStyleKitControls::set_ ## NAME(QQStyleKitControl *control) \
746{
747 m_controls.insert(TYPE, control); \
748}
749
750
751IMPLEMENT_ACCESSORS(abstractButton, QQStyleKitReader::ControlType::AbstractButton)
752IMPLEMENT_ACCESSORS(applicationWindow, QQStyleKitReader::ControlType::ApplicationWindow)
753IMPLEMENT_ACCESSORS(control, QQStyleKitReader::ControlType::Control)
754IMPLEMENT_ACCESSORS(busyIndicator, QQStyleKitReader::ControlType::BusyIndicator)
755IMPLEMENT_ACCESSORS(button, QQStyleKitReader::ControlType::Button)
756IMPLEMENT_ACCESSORS(flatButton, QQStyleKitReader::ControlType::FlatButton)
757IMPLEMENT_ACCESSORS(checkBox, QQStyleKitReader::ControlType::CheckBox)
758IMPLEMENT_ACCESSORS(checkDelegate, QQStyleKitReader::ControlType::CheckDelegate)
759IMPLEMENT_ACCESSORS(comboBox, QQStyleKitReader::ControlType::ComboBox)
760IMPLEMENT_ACCESSORS(delayButton, QQStyleKitReader::ControlType::DelayButton)
761IMPLEMENT_ACCESSORS(dial, QQStyleKitReader::ControlType::Dial)
762IMPLEMENT_ACCESSORS(dialog, QQStyleKitReader::ControlType::Dialog)
763IMPLEMENT_ACCESSORS(dialogButtonBox, QQStyleKitReader::ControlType::DialogButtonBox)
764IMPLEMENT_ACCESSORS(drawer, QQStyleKitReader::ControlType::Drawer)
765IMPLEMENT_ACCESSORS(horizontalHeaderViewDelegate, QQStyleKitReader::ControlType::HorizontalHeaderViewDelegate)
766IMPLEMENT_ACCESSORS(progressBar, QQStyleKitReader::ControlType::ProgressBar)
767IMPLEMENT_ACCESSORS(scrollBar, QQStyleKitReader::ControlType::ScrollBar)
768IMPLEMENT_ACCESSORS(scrollIndicator, QQStyleKitReader::ControlType::ScrollIndicator)
769IMPLEMENT_ACCESSORS(scrollView, QQStyleKitReader::ControlType::ScrollView)
770IMPLEMENT_ACCESSORS(searchField, QQStyleKitReader::SearchField)
771IMPLEMENT_ACCESSORS(slider, QQStyleKitReader::ControlType::Slider)
772IMPLEMENT_ACCESSORS(spinBox, QQStyleKitReader::ControlType::SpinBox)
773IMPLEMENT_ACCESSORS(swipeDelegate, QQStyleKitReader::ControlType::SwipeDelegate)
774IMPLEMENT_ACCESSORS(switchControl, QQStyleKitReader::ControlType::SwitchControl)
775IMPLEMENT_ACCESSORS(switchDelegate, QQStyleKitReader::ControlType::SwitchDelegate)
776IMPLEMENT_ACCESSORS(tabBar, QQStyleKitReader::ControlType::TabBar)
777IMPLEMENT_ACCESSORS(tabButton, QQStyleKitReader::ControlType::TabButton)
778IMPLEMENT_ACCESSORS(tableViewDelegate, QQStyleKitReader::ControlType::TableViewDelegate)
779IMPLEMENT_ACCESSORS(textField, QQStyleKitReader::ControlType::TextField)
780IMPLEMENT_ACCESSORS(textInput, QQStyleKitReader::ControlType::TextInput)
781IMPLEMENT_ACCESSORS(toolBar, QQStyleKitReader::ControlType::ToolBar)
782IMPLEMENT_ACCESSORS(toolButton, QQStyleKitReader::ControlType::ToolButton)
783IMPLEMENT_ACCESSORS(toolSeparator, QQStyleKitReader::ControlType::ToolSeparator)
784IMPLEMENT_ACCESSORS(toolTip, QQStyleKitReader::ControlType::ToolTip)
785IMPLEMENT_ACCESSORS(treeViewDelegate, QQStyleKitReader::ControlType::TreeViewDelegate)
786IMPLEMENT_ACCESSORS(tumbler, QQStyleKitReader::ControlType::Tumbler)
787IMPLEMENT_ACCESSORS(radioButton, QQStyleKitReader::ControlType::RadioButton)
788IMPLEMENT_ACCESSORS(radioDelegate, QQStyleKitReader::ControlType::RadioDelegate)
789IMPLEMENT_ACCESSORS(roundButton, QQStyleKitReader::ControlType::RoundButton)
790IMPLEMENT_ACCESSORS(itemDelegate, QQStyleKitReader::ControlType::ItemDelegate)
791IMPLEMENT_ACCESSORS(popup, QQStyleKitReader::ControlType::Popup)
792IMPLEMENT_ACCESSORS(pane, QQStyleKitReader::ControlType::Pane)
793IMPLEMENT_ACCESSORS(page, QQStyleKitReader::ControlType::Page)
794IMPLEMENT_ACCESSORS(pageIndicator, QQStyleKitReader::ControlType::PageIndicator)
795IMPLEMENT_ACCESSORS(frame, QQStyleKitReader::ControlType::Frame)
796IMPLEMENT_ACCESSORS(label, QQStyleKitReader::ControlType::Label)
797IMPLEMENT_ACCESSORS(groupBox, QQStyleKitReader::ControlType::GroupBox)
798IMPLEMENT_ACCESSORS(textArea, QQStyleKitReader::ControlType::TextArea)
799IMPLEMENT_ACCESSORS(menu, QQStyleKitReader::ControlType::Menu)
800IMPLEMENT_ACCESSORS(menuBar, QQStyleKitReader::ControlType::MenuBar)
801IMPLEMENT_ACCESSORS(menuBarItem, QQStyleKitReader::ControlType::MenuBarItem)
802IMPLEMENT_ACCESSORS(menuItem, QQStyleKitReader::ControlType::MenuItem)
803IMPLEMENT_ACCESSORS(menuSeparator, QQStyleKitReader::ControlType::MenuSeparator)
804IMPLEMENT_ACCESSORS(verticalHeaderViewDelegate, QQStyleKitReader::ControlType::VerticalHeaderViewDelegate)
805
806#undef IMPLEMENT_ACCESSORS
807
809{
810 for (auto *obj : children()) {
811 if (auto *customControl = qobject_cast<QQStyleKitCustomControl *>(obj)) {
812 const QQStyleKitExtendableControlType type = customControl->controlType();
813 const QQStyleKitExtendableControlType reserved
814 = QQStyleKitExtendableControlType(QQStyleKitReader::ControlType::Unspecified);
815 if (type >= reserved)
816 qmlWarning(this) << "CustomControls must use a controlType less than " << reserved;
817 if (m_controls.contains(type))
818 qmlWarning(this) << "CustomControl registered more than once: " << type;
819 m_controls.insert(type, customControl);
820 }
821 }
822}
823
824QT_END_NAMESPACE
825
826#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
QQmlListProperty< QObject > data()
Combined button and popup list for selecting options.
#define IMPLEMENT_ACCESSORS(NAME, TYPE)