aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc6
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc4
-rw-r--r--src/quickcontrols2/qquickstyle.cpp18
3 files changed, 25 insertions, 3 deletions
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
index 866aef23..06201404 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
@@ -136,8 +136,6 @@
\list
\li At least one QML file whose name matches a control (for example,
\c Button.qml) must exist.
-
- The Default style will be used for any controls that aren't implemented.
\li The files must be in a directory in the filesystem or in the
\l {The Qt Resource System}{resource system}.
@@ -155,6 +153,10 @@
for example.
\endlist
+ By default, the styling system uses the Default style as a fallback for
+ controls that aren't implemented. To customize or extend any other built-in
+ style, it is possible to specify a different fallback style using \l QQuickStyle.
+
What this means is that you can implement as many controls as you like for
your custom style, and place them almost anywhere. It also allows users to
create their own styles for your application.
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc
index acca81b8..c83adf4b 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-environment.qdoc
@@ -43,6 +43,10 @@
The value can be either one of the built-in styles, for example \c "Material",
or the path to a custom style such as \c ":/mystyle".
\row
+ \li \c QT_QUICK_CONTROLS_FALLBACK_STYLE
+ \li Specifies a fallback style for \l {Creating a Custom Style}{custom styles}.
+ The value can be one of the built-in styles, for example \c "Material",
+ \row
\li \c QT_QUICK_CONTROLS_CONF
\li Specifies the location of the \l {Qt Quick Controls 2 configuration file}.
By default, the configuration file is loaded from the application's
diff --git a/src/quickcontrols2/qquickstyle.cpp b/src/quickcontrols2/qquickstyle.cpp
index 80a7abef..f4fc1764 100644
--- a/src/quickcontrols2/qquickstyle.cpp
+++ b/src/quickcontrols2/qquickstyle.cpp
@@ -80,6 +80,19 @@ QT_BEGIN_NAMESPACE
Qt Quick Controls 2. It is not possible to change the style after the QML
types have been registered.
+ The style can also be specified as a path to a custom style, such as
+ \c ":/mystyle". See \l {Creating a Custom Style} for more details about
+ building custom styles. Custom styles do not need to implement all controls.
+ By default, the styling system uses the \l {Default style} as a fallback
+ for controls that a custom style does not provide. It is possible to
+ specify a different fallback style to customize or extend one of the
+ built-in styles.
+
+ \code
+ QQuickStyle::setStyle(":/mystyle");
+ QQuickStyle::setFallbackStyle("Material");
+ \endcode
+
\sa {Styling Qt Quick Controls 2}
*/
@@ -273,13 +286,16 @@ void QQuickStyle::setStyle(const QString &style)
}
/*!
- \since 5.9
+ \since 5.8
Sets the application fallback style to \a style.
\note The fallback style must be the name of one of the built-in Qt Quick Controls 2 styles, e.g. "Material".
\note The style must be configured \b before loading QML that imports Qt Quick Controls 2.
It is not possible to change the style after the QML types have been registered.
+
+ The fallback style can be also specified by setting the \c QT_QUICK_CONTROLS_FALLBACK_STYLE
+ \l {Supported Environment Variables in Qt Quick Controls 2}{environment variable}.
*/
void QQuickStyle::setFallbackStyle(const QString &style)
{