Supported Environment Variables in Qt Quick Controls 2

This page contains a list of all environment variables that Qt Quick Controls 2 supports. The environment variables are primarily meant for testing purposes, but they can also be used to set system-wide defaults.

變量 描述
QT_QUICK_CONTROLS_STYLE 指定默認 Qt Quick Controls 2 style . The value can be either one of the built-in styles, for example "Material" , or the path to a custom style such as ":/mystyle" .
QT_QUICK_CONTROLS_FALLBACK_STYLE Specifies a fallback style for custom styles . The value can be one of the built-in styles, for example "Material" ,
QT_QUICK_CONTROLS_STYLE_PATH Specifies a list of additional paths that are used to lookup Qt Quick Controls 2 styles . Multiple path entries must be separated by ':' under Unix and ';' under Windows. By default, styles are looked up from $QML2_IMPORT_PATH/QtQuick/Controls.2 .
QT_QUICK_CONTROLS_CONF Specifies the location of the Qt Quick Controls 2 configuration file . By default, the configuration file is loaded from the application's resources in ":/qtquickcontrols2.conf" .
QT_QUICK_CONTROLS_HOVER_ENABLED Specifies whether Qt Quick Controls 2 use hover effects . The value can be set to 0 or 1 to disable or enable hover effects, respectively.

想象風格 specific environment variables:

變量 描述
QT_QUICK_CONTROLS_IMAGINE_PATH

Specifies the path to the directory that contains the Imagine style assets. If not specified, the built-in assets are used.

For example, to specify a path to a directory stored in the 資源係統 :

QT_QUICK_CONTROLS_IMAGINE_PATH=:/imagine-assets
								

To specify a relative path to a local directory:

QT_QUICK_CONTROLS_IMAGINE_PATH=imagine-assets
								

注意: Due to a technical limitation, the path should not be named "imagine" if it is relative to the qtquickcontrols2.conf 文件。

材質風格 specific environment variables:

變量 描述
QT_QUICK_CONTROLS_MATERIAL_THEME 指定默認 材質主題 . The value can be one of the available themes, for example "Dark" .
QT_QUICK_CONTROLS_MATERIAL_VARIANT

Specifies the Material variant. The Material Design has two variants: a normal variant designed for touch devices, and a dense variant for desktop. The dense variant uses smaller sizes for controls and their fonts.

The value can be "Normal" or "Dense" .

QT_QUICK_CONTROLS_MATERIAL_ACCENT 指定默認 Material accent color 。值可以是任何 color , but it is recommended to use one of the 預定義材質顔色 ,例如 "Teal" .
QT_QUICK_CONTROLS_MATERIAL_PRIMARY 指定默認 Material primary color 。值可以是任何 color , but it is recommended to use one of the 預定義材質顔色 ,例如 "BlueGrey" .
QT_QUICK_CONTROLS_MATERIAL_FOREGROUND 指定默認 材質前景顔色 。值可以是任何 color ,或某一 預定義材質顔色 ,例如 "Brown" .
QT_QUICK_CONTROLS_MATERIAL_BACKGROUND 指定默認 材質背景色 。值可以是任何 color ,或某一 預定義材質顔色 ,例如 "Grey" .

Universal style specific environment variables:

變量 描述
QT_QUICK_CONTROLS_UNIVERSAL_THEME 指定默認 通用主題 . The value can be one of the available themes, for example "Dark" .
QT_QUICK_CONTROLS_UNIVERSAL_ACCENT 指定默認 Universal accent color 。值可以是任何 color , but it is recommended to use one of the 預定義通用顔色 ,例如 "Violet" .
QT_QUICK_CONTROLS_UNIVERSAL_FOREGROUND 指定默認 通用前景顔色 。值可以是任何 color ,或某一 預定義通用顔色 ,例如 "Brown" .
QT_QUICK_CONTROLS_UNIVERSAL_BACKGROUND 指定默認 通用背景色 。值可以是任何 color ,或某一 預定義通用顔色 ,例如 "Steel" .