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