Supported Environment Variables in Qt Quick Controls

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

VariableDescription
QT_QUICK_CONTROLS_STYLESpecifies the default Qt Quick Controls style. The value can be either one of the built-in styles, for example "Material", or a custom style such as "MyStyle".
QT_QUICK_CONTROLS_FALLBACK_STYLESpecifies a fallback style for custom styles. The value can be one of the built-in styles, for example "Material",
QT_QUICK_CONTROLS_CONFSpecifies the location of the Qt Quick Controls configuration file. By default, the configuration file is loaded from the application's resources in ":/qtquickcontrols2.conf".
QT_QUICK_CONTROLS_HOVER_ENABLEDSpecifies whether Qt Quick Controls use hover effects. The value can be set to 0 or 1 to disable or enable hover effects, respectively.

Imagine style specific environment variables:

VariableDescription
QT_QUICK_CONTROLS_IMAGINE_PATHSpecifies 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 resource system:

QT_QUICK_CONTROLS_IMAGINE_PATH=:/imagine-assets

To specify a relative path to a local directory:

QT_QUICK_CONTROLS_IMAGINE_PATH=imagine-assets

Note: Due to a technical limitation, the path should not be named "imagine" if it is relative to the qtquickcontrols2.conf file.

QT_QUICK_CONTROLS_IMAGINE_SMOOTHSet to 1 to enable smooth scaling for 9-patch images. This environment variable was added in Qt 6.5.

Material style specific environment variables:

VariableDescription
QT_QUICK_CONTROLS_MATERIAL_THEMESpecifies the default Material theme. The value can be one of the available themes, for example "Dark".
QT_QUICK_CONTROLS_MATERIAL_VARIANTSpecifies 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_ACCENTSpecifies the default Material accent color. The value can be any color, but it is recommended to use one of the pre-defined Material colors, for example "Teal".
QT_QUICK_CONTROLS_MATERIAL_PRIMARYSpecifies the default Material primary color. The value can be any color, but it is recommended to use one of the pre-defined Material colors, for example "BlueGrey".
QT_QUICK_CONTROLS_MATERIAL_FOREGROUNDSpecifies the default Material foreground color. The value can be any color, or one of the pre-defined Material colors, for example "Brown".
QT_QUICK_CONTROLS_MATERIAL_BACKGROUNDSpecifies the default Material background color. The value can be any color, or one of the pre-defined Material colors, for example "Grey".

Universal style specific environment variables:

VariableDescription
QT_QUICK_CONTROLS_UNIVERSAL_THEMESpecifies the default Universal theme. The value can be one of the available themes, for example "Dark".
QT_QUICK_CONTROLS_UNIVERSAL_ACCENTSpecifies the default Universal accent color. The value can be any color, but it is recommended to use one of the pre-defined Universal colors, for example "Violet".
QT_QUICK_CONTROLS_UNIVERSAL_FOREGROUNDSpecifies the default Universal foreground color. The value can be any color, or one of the pre-defined Universal colors, for example "Brown".
QT_QUICK_CONTROLS_UNIVERSAL_BACKGROUNDSpecifies the default Universal background color. The value can be any color, or one of the pre-defined Universal colors, for example "Steel".

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.