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" .