1// Copyright (C) 2017 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
5 \page qtquickcontrols-customize.html
6 \keyword Customizing Qt Quick Controls 2
7 \title Customizing Qt Quick Controls
8 \brief A set of UI controls to create user interfaces in Qt Quick
10 Qt Quick Controls consist of a hierarchy (tree) of items. In order to
11 provide a custom look and feel, the default QML implementation of each
12 item can be replaced with a custom one.
14 \section1 Customizing a Control
16 Sometimes you'll want to create a "one-off" look for a specific part of
17 your UI, and use a complete style everywhere else. Perhaps you're happy
18 with the style you're using, but there's a certain button that has some
21 The first way to create this button is to simply define it in-place,
22 wherever it is needed. For example, perhaps you're not satisfied with the
23 Basic style's Button having square corners. To make them rounded, you
24 can override the \l {Control::}{background} item and set the radius
25 property of Rectangle:
27 \include customize-button-background.qdocinc file
29 \note as the different items that make up a control in any given style are
30 designed to work together, it may be necessary to override other items to
31 get the look you're after. In addition, not all styles can be customized.
32 See the note in \l {Customization Reference} for more information.
34 The second way to create the button is good if you plan to use your rounded
35 button in several places. It involves moving the code into its own QML file
38 For this approach, we'll copy the background code from the Basic style's
39 \c Button.qml. This file can be found in the following path in your Qt
42 \c {$QTDIR/qml/QtQuick/Controls/Basic/Button.qml}
44 After doing that, we'll simply add the following line:
50 To avoid confusion with the controls in the
51 module itself, we'll call the file \c MyButton.qml. To use the control in
52 your application, refer to it by its filename:
55 import QtQuick.Controls
59 text: qsTr("A Special Button")
64 The third way to create the button is a bit more structured, both in terms
65 of where the file sits in the file system and how it is used in QML. First,
66 copy an existing file as you did above, but this time, put it into a
67 subfolder in your project named (for example) \c controls. To use the
68 control, first import the folder into a namespace:
71 import QtQuick.Controls
72 import "controls" as MyControls
76 text: qsTr("A Special Button")
81 As you now have the \c MyControls namespace, you can name the controls after
82 their actual counterparts in the Qt Quick Controls module. You can repeat
83 this process for any control that you wish to add.
85 An added benefit of these three methods is that it's not necessary to
86 implement the template from scratch.
88 \note the three approaches mentioned here do not work for customizing the
89 attached \l ToolTip, as that is a shared item created internally. To do
90 a one-off customization of a \c ToolTip, see \l {Custom Tool Tips}. To
91 customize the attached \c ToolTip, it must be provided as part of
92 \l {Creating a Custom Style}{your own style}.
94 \section1 Creating a Custom Style
96 There are several ways to go about creating your own styles. Below, we'll
97 explain the various approaches.
99 \section2 Definition of a Style
101 In Qt Quick Controls, a style is essentially a set of QML files within a
102 single directory. There are four requirements for a style to be
103 \l {Using Styles in Qt Quick Controls}{usable}:
106 \li At least one QML file whose name matches a control (for example,
107 \c Button.qml) must exist.
108 \li Each QML file must contain the relevant type from the \l {Qt Quick Templates 2}
109 {QtQuick.Templates} import as the root item. For example,
110 Button.qml must contain a Button template as its root item.
112 If we instead used the corresponding type from the \l {Qt Quick Controls}
113 {QtQuick.Controls} import as we did in the previous section, it would not work:
114 the control we were defining would try to derive from itself.
115 \li A \l {Module Definition qmldir Files}{qmldir} file must exist alongside
116 the QML file(s). Below is an example of a simple \c qmldir file for a style that
121 Button 2.15 Button.qml
124 If you're using \l {Compile-Time Style Selection}{compile-time style
125 selection}, the qmldir should also import the fallback style:
129 import QtQuick.Controls.Basic auto
132 This can also be done for \l {Run-Time Style Selection}{run-time style selection}
133 instead of using, for example, \l QQuickStyle::setFallbackStyle().
135 The directory structure for such a style looks like this:
142 \li The files must be in a directory that is findable via the \l[QtQml]{QML Import Path}.
144 For example, if the path to \e MyStyle directory mentioned above was
145 \c /home/user/MyApp/MyStyle, then \c /home/user/MyApp must be added to
148 To \l {Using Styles in Qt Quick Controls}{use} \e MyStyle in \e MyApp,
152 \li \c {./MyApp -style MyStyle}
155 The style name must match the casing of the style directory; passing
156 \e mystyle or \e MYSTYLE is not supported.
159 By default, the styling system uses the Basic style as a fallback for
160 controls that aren't implemented. To customize or extend any other built-in
161 style, it is possible to specify a different fallback style using
162 \l[QtQuickControls2]{QQuickStyle}.
164 What this means is that you can implement as many controls as you like for
165 your custom style, and place them almost anywhere. It also allows users to
166 create their own styles for your application.
168 \section3 Previewing Custom Styles in Qt Quick Designer
170 Using the approach above, it is possible to preview a custom style
171 in Qt Quick Designer. In order to do so,
172 ensure that the project has a
173 \l {Qt Quick Controls Configuration File}{qtquickcontrols2.conf} file,
174 and that the following entry exists:
181 For more information, take a look at the
182 \l {Qt Quick Controls - Flat Style}{Flat Style example}.
184 \section2 Style-specific C++ Extensions
186 Sometimes you may need to use C++ to extend your custom style. There are two
187 ways to expose such types to QML:
190 \li If the style that uses the type is the only style used by an application,
191 it's enough to register it with the QML engine via qmlRegisterType():
194 qmlRegisterType<ACoolCppItem>("MyApp", 1, 0, "ACoolItem");
197 See \l {Using C++ Data From QML} for more information about this.
198 \li If the style that uses the type is one of many styles used by an
199 application, it may be better to only register it when necessary. This
200 is the point at which it would make sense to implement your own
201 \l {Creating C++ Plugins for QML}{QML plugin}.
203 Using a plugin as part of your style is not that much different from
204 using a set of QML files. The only difference is that the plugin and
205 its \c qmldir file must be present in the same directory as the QML
209 \section3 Considerations for custom styles
211 When implementing your own style and customizing controls, there are some
212 points to keep in mind to ensure that your application is as performant as
215 \section4 Avoid assigning an id to styles' implementations of item delegates
217 As explained in \l {Definition of a Style}, when you implement your
218 own style for a control, you start off with the relevant template for
219 that control. For example, a style's \c Button.qml will be structured
226 background: Rectangle {
238 When you use a Button in your application, the \c background and
239 \c contentItem items will be created and parented to the root \c Button
243 // Creates the Button root item, the Rectangle background,
244 // and the Text contentItem.
246 text: qsTr("Confirm")
250 Suppose you then needed to do a one-off customization of the Button (as
251 explained in \l {Customizing a Control}):
253 \include customize-button-background.qdocinc file
255 In QML, this would normally result in both the default \c background
256 implementation and the one-off, custom \c background items being created.
257 Qt Quick Controls uses a technique that avoids creating both items, and
258 instead only creates the custom \c background, greatly improving the
259 creation performance of controls.
261 This technique relies on the absence of an \l {The id Attribute}{id} in the
262 style's implementation of that item. If an id is assigned, the technique
263 cannot work, and both items will be created. For example, it can be
264 tempting to assign an id to the \c background or \c contentItem so that
265 other objects within the file can refer to those items:
271 background: Rectangle {
277 // Use backgroundRect in some way...
284 With this code, every time a Button instance with a customized background
285 is created, both backgrounds will be created, resulting in sub-optimal
286 creation performance.
288 Prior to Qt 5.15, the old, unused background would be deleted to release
289 the resources associated with it. However, as the control does not own the
290 items, it should not delete them. As of Qt 5.15, old items are no longer
291 deleted, and so the \c backgroundRect item will live longer than it needs
292 to—typically until the application exits. Although the old item will be
293 hidden, visually unparented from the control, and removed from the
294 accessibility tree, it is important to keep the creation time and memory
295 usage of these unused items in mind when assigning an id in this context.
297 \section4 Avoid imperative assignments of custom items
299 The technique mentioned in the section above only works when an item is
300 \l {Prefer Declarative Bindings Over Imperative Assignments}{declaratively}
301 assigned for the first time, and so imperative assignments will result in
302 orphaned items. Always use declarative bindings to assign custom items
305 \section4 Don't import QtQuick.Controls in QML implementations
307 When writing the QML for your style's implementation of a control,
308 it's important not to import \c {QtQuick.Controls}. Doing so will
309 prevent the QML from being compiled by the QML compiler.
311 \section4 Implement types used by other types
313 Suppose you were using ScrollViews in your application, and decided that
314 you want to customize their scroll bars. It is tempting to just implement a
315 custom ScrollBar.qml and have ScrollView pick up the customized ScrollBar
316 automatically. However, this will not work. You must implement both
317 ScrollBar.qml \e and ScrollView.qml.
319 \section3 Attached properties
321 It is common for a style to have certain properties or attributes that
322 apply to all controls. \l {Attached Properties and Attached Signal
323 Handlers}{Attached properties} are a great way of extending an item in QML
324 without having to modify any existing C++ belonging to that item. For
325 example, both the \l {Material Style}{Material} and \l {Universal
326 Style}{Universal} styles have an attached theme property that controls
327 whether an item and its children will be rendered in a light or dark theme.
329 As an example, let's add an attached property that controls elevation. Our
330 style will illustrate the elevation with a drop shadow; the higher the
331 elevation, the larger the shadow.
333 The first step is to \l {Qt Creator: Project Types}{create a new Qt Quick
334 Controls application} in Qt Creator. After that, we
335 \l {Qt Creator: Creating C++ Classes}{add a C++ type} that stores the elevation. Since
336 the type will be used for every control supported by our style, and because
337 we may wish to add other attached properties later on, we'll call it
338 MyStyle. Here is \c MyStyle.h:
347 class MyStyle : public QObject
350 Q_PROPERTY(int elevation READ elevation WRITE setElevation NOTIFY elevationChanged)
353 explicit MyStyle(QObject *parent = nullptr);
355 static MyStyle *qmlAttachedProperties(QObject *object);
357 int elevation() const;
358 void setElevation(int elevation);
361 void elevationChanged();
367 QML_DECLARE_TYPEINFO(MyStyle, QML_HAS_ATTACHED_PROPERTIES)
377 MyStyle::MyStyle(QObject *parent) :
383 MyStyle *MyStyle::qmlAttachedProperties(QObject *object)
385 return new MyStyle(object);
388 int MyStyle::elevation() const
393 void MyStyle::setElevation(int elevation)
395 if (elevation == m_elevation)
398 m_elevation = elevation;
399 emit elevationChanged();
403 The \c MyStyle type is special in the sense that it shouldn't be
404 instantiated, but rather used for its attached properties. For that reason,
405 we register it in the following manner in \c main.cpp:
408 #include <QGuiApplication>
409 #include <QQmlApplicationEngine>
413 int main(int argc, char *argv[])
415 QGuiApplication app(argc, argv);
417 qmlRegisterUncreatableType<MyStyle>("MyStyle", 1, 0, "MyStyle", "MyStyle is an attached property");
419 QQmlApplicationEngine engine;
420 // Make the directory containing our style known to the QML engine.
421 engine.addImportPath(":/");
422 engine.load(QUrl(QLatin1String("qrc:/main.qml")));
428 We then copy \c Button.qml from the Basic style in
429 \c {$QTDIR/qml/QtQuick/Controls/Basic/} into a new \c myproject folder in our
430 project directory. Add the newly copied \c Button.qml to \c qml.qrc, which is
431 the resource file that contains our QML files.
433 Next, we add a drop shadow to the \l {Control::}{background} delegate of
438 import QtGraphicalEffects
442 background: Rectangle {
445 layer.enabled: control.enabled && control.MyStyle.elevation > 0
446 layer.effect: DropShadow {
448 color: control.visualFocus ? "#330066ff" : "#aaaaaa"
449 samples: control.MyStyle.elevation
458 \li Don't bother using the drop shadow when the elevation is \c 0
459 \li Change the shadow's color depending on whether or not the button has
461 \li Make the size of the shadow depend on the elevation
464 To try out the attached property, we create a \l Row with two Buttons in
469 import QtQuick.Controls
481 anchors.centerIn: parent
488 MyStyle.elevation: 10
494 One button has no elevation, and the other has an elevation of \c 10.
496 With that in place, we can run our example. To tell the application to
497 use our new style, we pass \c {-style MyStyle} as an application
498 argument, but there are \l {Using Styles in Qt Quick Controls}{many
499 ways} to specify the style to use.
503 \image qtquickcontrols-customize-buttons.png
505 Note that the \c {import MyStyle 1.0} statement is only necessary
506 because we are using the attached property belonging to \c MyStyle.
507 Both buttons will use our custom style, even if we were to remove the
510 \section1 Customization Reference
512 The following snippets present examples where the Basic style's controls
513 have been customized using the same approach as the
514 \l {Customizing a Control} section. The code can be used as a starting
515 point to implement a custom look and feel.
517 \note The \l {macOS Style}{macOS} and \l {Windows Style}{Windows} styles
518 are not suitable for customizing.
519 \include customizing-native-styles.qdocinc
521 \section2 Customizing ApplicationWindow
523 ApplicationWindow consists of one visual item:
524 \l {ApplicationWindow::background}{background}.
528 import QtQuick.Controls
533 background: Rectangle {
535 GradientStop { position: 0; color: "#ffffff" }
536 GradientStop { position: 1; color: "#c1bbf9" }
543 \section2 Customizing BusyIndicator
545 BusyIndicator consists of two visual items: \l {Control::background}{background}
546 and \l {Control::contentItem}{contentItem}.
548 \image qtquickcontrols-busyindicator-custom.png
550 \snippet qtquickcontrols-busyindicator-custom.qml file
553 \section2 Customizing Button
555 Button consists of two visual items: \l {Control::background}{background}
556 and \l {Control::contentItem}{content item}.
558 \image qtquickcontrols-button-custom.png
560 \snippet qtquickcontrols-button-custom.qml file
563 \section2 Customizing CheckBox
565 CheckBox consists of three visual items: \l {Control::background}{background},
566 \l {Control::contentItem}{contentItem} and \l {AbstractButton::indicator}{indicator}.
568 \image qtquickcontrols-checkbox-custom.png
570 \snippet qtquickcontrols-checkbox-custom.qml file
572 \section2 Customizing CheckDelegate
574 CheckDelegate consists of three visual items: \l {Control::background}{background},
575 \l {Control::contentItem}{contentItem} and \l {AbstractButton::indicator}{indicator}.
577 \image qtquickcontrols-checkdelegate-custom.png
579 \snippet qtquickcontrols-checkdelegate-custom.qml file
582 \section2 Customizing ComboBox
584 ComboBox consists of \l {Control::background}{background},
585 \l {Control::contentItem}{content item}, \l {ComboBox::popup}{popup},
586 \l {ComboBox::indicator}{indicator}, and \l {ComboBox::delegate}{delegate}.
588 \image qtquickcontrols-combobox-custom.png
590 \snippet qtquickcontrols-combobox-custom.qml file
592 As explained in \l {ComboBox Model Roles}, ComboBox supports multiple
595 Since \l {qml-data-models}{all the models provide an anonymous property}
596 with \c modelData, the following expression retrieves the right text in
600 text: model[control.textRole]
603 When you provide a specific \c textRole and a model with structured
604 data that provides the selected role, this is expression is a regular
605 property lookup. When you provide a model with singular data, such as
606 a list of strings, and an empty \c textRole, this expression retrieves
609 \section2 Customizing DelayButton
611 DelayButton consists of two visual items: \l {Control::background}{background}
612 and \l {Control::contentItem}{content item}.
614 \image qtquickcontrols-delaybutton-custom.png
616 \snippet qtquickcontrols-delaybutton-custom.qml file
619 \section2 Customizing Dial
621 Dial consists of two visual items: \l {Control::background}{background}
622 and \l {Dial::handle}{handle}.
624 \image qtquickcontrols-dial-custom.png
626 \snippet qtquickcontrols-dial-custom.qml file
629 \section2 Customizing Drawer
631 Drawer can have a visual \l {Control::background}{background}
635 background: Rectangle {
639 height: parent.height
646 \section2 Customizing Frame
648 Frame consists of one visual item: \l {Control::background}{background}.
650 \image qtquickcontrols-frame-custom.png
652 \snippet qtquickcontrols-frame-custom.qml file
655 \section2 Customizing GroupBox
657 GroupBox consists of two visual items: \l {Control::background}{background}
658 and \l {GroupBox::label}{label}.
660 \image qtquickcontrols-groupbox-custom.png
662 \snippet qtquickcontrols-groupbox-custom.qml file
665 \section2 Customizing ItemDelegate
667 ItemDelegate consists of two visual items: \l {Control::background}{background}
668 and \l {Control::contentItem}{content item}.
670 \image qtquickcontrols-itemdelegate-custom.png
672 \snippet qtquickcontrols-itemdelegate-custom.qml file
675 \section2 Customizing Label
677 Label can have a visual \l {Label::background}{background} item.
679 \image qtquickcontrols-label-custom.png
681 \snippet qtquickcontrols-label-custom.qml file
684 \section2 Customizing Menu
687 \li \l Menu consists of a visual \l {Popup::background}{background} item.
688 \li \l MenuItem consists of four visual items: \l {Control::background}{background},
689 \l {Control::contentItem}{content item}, \l {AbstractButton::}{indicator}, and
690 \l {MenuItem::}{arrow}.
691 \li \l MenuSeparator consists of a visual \l {Control::background}{background} and
692 \l {Control::contentItem}{content item}.
695 \image qtquickcontrols-menu-custom.png
697 \quotefromfile qtquickcontrols-menu-custom.qml
698 \skipto import QtQuick
699 \printuntil import QtQuick.Controls
704 \section2 Customizing MenuBar
706 MenuBar can have a visual \l {Control::background}{background} item,
707 and MenuBarItem consists of two visual items: \l {Control::background}
708 {background} and \l {Control::contentItem}{content item}.
710 \image qtquickcontrols-menubar-custom.png
712 \quotefromfile qtquickcontrols-menubar-custom.qml
713 \skipto import QtQuick
714 \printuntil import QtQuick.Controls
719 \section2 Customizing PageIndicator
721 PageIndicator consists of a \l {Control::background}{background}, \l {Control::contentItem}{content item}, and \l {PageIndicator::delegate}{delegate}.
723 \image qtquickcontrols-pageindicator-custom.png
725 \snippet qtquickcontrols-pageindicator-custom.qml file
728 \section2 Customizing Pane
730 Pane consists of a \l {Control::background}{background}.
732 \image qtquickcontrols-pane-custom.png
734 \snippet qtquickcontrols-pane-custom.qml file
737 \section2 Customizing Popup
739 Popup consists of a \l {Popup::background}{background} and
740 \l {Popup::contentItem}{content item}.
742 \image qtquickcontrols-popup-custom.png
744 \quotefromfile qtquickcontrols-popup-custom.qml
745 \skipto import QtQuick
746 \printuntil import QtQuick.Controls
755 \section2 Customizing ProgressBar
757 ProgressBar consists of two visual items: \l {Control::background}{background}
758 and \l {Control::contentItem}{content item}.
760 \image qtquickcontrols-progressbar-custom.png
762 \snippet qtquickcontrols-progressbar-custom.qml file
765 \section2 Customizing RadioButton
767 RadioButton consists of three visual items: \l {Control::background}{background},
768 \l {Control::contentItem}{content item} and \l {AbstractButton::indicator}{indicator}.
770 \image qtquickcontrols-radiobutton-custom.png
772 \snippet qtquickcontrols-radiobutton-custom.qml file
775 \section2 Customizing RadioDelegate
777 RadioDelegate consists of three visual items: \l {Control::background}{background},
778 \l {Control::contentItem}{contentItem} and \l {AbstractButton::indicator}{indicator}.
780 \image qtquickcontrols-radiodelegate-custom.png
782 \snippet qtquickcontrols-radiodelegate-custom.qml file
785 \section2 Customizing RangeSlider
787 RangeSlider consists of three visual items:
788 \l {Control::background}{background},
789 \l {RangeSlider::first}{first.handle} and
790 \l {RangeSlider::second.handle}{second.handle}.
792 \image qtquickcontrols-rangeslider-custom.png
794 \snippet qtquickcontrols-rangeslider-custom.qml file
797 \section2 Customizing RoundButton
799 RoundButton can be customized in the same manner as
800 \l {Customizing Button}{Button}.
803 \section2 Customizing ScrollBar
805 ScrollBar consists of two visual items: \l {Control::background}{background}
806 and \l {Control::contentItem}{content item}.
808 \image qtquickcontrols-scrollbar-custom.png
810 \snippet qtquickcontrols-scrollbar-custom.qml file
813 \section2 Customizing ScrollIndicator
815 ScrollIndicator consists of two visual items: \l {Control::background}{background}
816 and \l {Control::contentItem}{content item}.
818 \image qtquickcontrols-scrollindicator-custom.png
820 \snippet qtquickcontrols-scrollindicator-custom.qml file
823 \section2 Customizing ScrollView
825 ScrollView consists of a \l {Control::background}{background} item,
826 and horizontal and vertical scroll bars.
828 \image qtquickcontrols-scrollview-custom.png
830 \snippet qtquickcontrols-scrollview-custom.qml file
833 \section2 Customizing Slider
835 Slider consists of two visual items: \l {Control::background}{background},
836 and \l {Slider::handle}{handle}.
838 \image qtquickcontrols-slider-custom.png
840 \snippet qtquickcontrols-slider-custom.qml file
843 \section2 Customizing SpinBox
845 SpinBox consists of four visual items: \l {Control::background}{background},
846 \l {Control::contentItem}{contentItem}, \l {SpinBox::up.indicator}{up indicator},
847 and \l {SpinBox::down.indicator}{down indicator}.
849 \image qtquickcontrols-spinbox-custom.png
851 \snippet qtquickcontrols-spinbox-custom.qml file
854 \section2 Customizing SplitView
856 SplitView consists of a visual \l {SplitView::handle}{handle} delegate.
858 \image qtquickcontrols-splitview-custom.png
860 \snippet qtquickcontrols-splitview-custom.qml 1
863 \section2 Customizing StackView
865 StackView can have a visual \l {Control::background}{background}
866 item, and it allows customizing the transitions that are used for
867 push, pop, and replace operations.
869 \snippet qtquickcontrols-stackview-custom.qml file
872 \section2 Customizing SwipeDelegate
874 SwipeDelegate consists of six visual items: \l {Control::background}{background},
875 \l {Control::contentItem}{content item}, \l {AbstractButton::indicator}{indicator},
876 \c swipe.left, \c swipe.right, and \c swipe.behind.
878 \image qtquickcontrols-swipedelegate-custom.png
880 \snippet qtquickcontrols-swipedelegate-custom.qml file
883 \section2 Customizing SwipeView
885 SwipeView can have a visual \l {Control::background}{background}
886 item. The navigation is implemented by the \l {Control::contentItem}
889 \snippet qtquickcontrols-swipeview-custom.qml file
892 \section2 Customizing Switch
894 Switch consists of three visual items: \l {Control::background}{background},
895 \l {Control::contentItem}{content item} and \l {AbstractButton::indicator}{indicator}.
897 \image qtquickcontrols-switch-custom.png
899 \snippet qtquickcontrols-switch-custom.qml file
901 \section2 Customizing SwitchDelegate
903 SwitchDelegate consists of three visual items: \l {Control::background}{background},
904 \l {Control::contentItem}{contentItem} and \l {AbstractButton::indicator}{indicator}.
906 \image qtquickcontrols-switchdelegate-custom.png
908 \snippet qtquickcontrols-switchdelegate-custom.qml file
911 \section2 Customizing TabBar
913 TabBar consists of two visual items: \l {Control::background}{background},
914 and \l {Control::contentItem}{contentItem}.
916 \image qtquickcontrols-tabbar-custom.png
918 \snippet qtquickcontrols-tabbar-custom.qml file
921 \section2 Customizing TabButton
923 TabButton can be customized in the same manner as
924 \l {Customizing Button}{Button}.
927 \section2 Customizing TextArea
929 TextArea consists of a \l {TextArea::background}{background} item.
931 \image qtquickcontrols-textarea-custom.png
933 \snippet qtquickcontrols-textarea-custom.qml file
936 \section2 Customizing TextField
938 TextField consists of a \l {TextField::background}{background} item.
940 \image qtquickcontrols-textfield-custom.png
942 \snippet qtquickcontrols-textfield-custom.qml file
945 \section2 Customizing ToolBar
947 ToolBar consists of one visual item: \l {Control::background}{background}.
949 \image qtquickcontrols-toolbar-custom.png
951 \snippet qtquickcontrols-toolbar-custom.qml file
954 \section2 Customizing ToolButton
956 ToolButton consists of two visual items: \l {Control::background}{background}
957 and \l {Control::contentItem}{content item}.
959 \image qtquickcontrols-toolbutton-custom.png
961 \snippet qtquickcontrols-toolbutton-custom.qml file
964 \section2 Customizing ToolSeparator
966 ToolSeparator consists of two visual items: \l {Control::background}{background}
967 and \l {Control::contentItem}{content item}.
969 \image qtquickcontrols-toolseparator-custom.png
971 \snippet qtquickcontrols-toolseparator-custom.qml file
974 \section2 Customizing ToolTip
976 ToolTip consists of two visual items: \l {Popup::background}{background}
977 and \l {Popup::contentItem}{content item}.
979 \quotefromfile qtquickcontrols-tooltip-custom.qml
980 \skipto import QtQuick
981 \printuntil import QtQuick.Controls
987 \include qquicktooltip.qdocinc customize-note
989 \section2 Customizing Tumbler
991 Tumbler consists of three visual items:
992 \l {Control::background}{background},
993 \l {Control::contentItem}{contentItem}, and
994 \l {Tumbler::delegate}{delegate}.
996 \image qtquickcontrols-tumbler-custom.png
998 \snippet qtquickcontrols-tumbler-custom.qml file
1000 If you want to define your own contentItem, use either a \l ListView or
1001 \l PathView as the root item. For a wrapping Tumbler, use PathView:
1003 \snippet qtquickcontrols-tumbler-pathView.qml contentItem
1005 For a non-wrapping Tumbler, use ListView:
1007 \snippet qtquickcontrols-tumbler-listView.qml contentItem