List of Qt and QML environment variables
-
Is there a list somewhere with all the Qt environment variables and their meaning?
I did a grep on Qt source code and there are dozens of environment variables that influence the run time behaviour of an application, but I can only find information about a handfull of them on the qt-project site.
E.g.
QML_FIXED_ANIMATION_STEP (use it when your animations look weird on QtQuick 2 on an embedded device) ,
QML_IMPORT_TRACE (to show qml import loading mechanism, "see here":http://qt-project.org/doc/qt-5.0/qtquick/qtquick-debugging.html)
QML_SHOW_FRAMERATE (...)
...and so on... -
- Most variables/enums for Qt are in
QtCore.Qt
: https://doc.qt.io/qtforpython-6/PySide6/QtCore/Qt.html
Many were added in Qt5:
(a)
WA
stands forWidget Attribute
: QtCore.Qt.WidgetAttribute
(b)AA
stands forApplication Attribute
: .QtCore.Qt.ApplicationAttributeThese are used within code and set with
QAppliction.setAttribute
and tested withQApplication.testAttribue
. e.g.from PyQt5.QtCore import Qt from PyQt5.QtWidgets import QApplication app = QApplication([]) app.setAttribute(Qt.AA_DontShowIconsInMenus, True)
There are many others that control a vast array of the items in
Qt
.-
Environment variables are often used for specific plugins and abstractions. For example
(a)
QPA
stand forQt Platform Abstraction
, which controls the platform/windowing mode your app uses: https://doc.qt.io/qt-5/qpa.html#qpa-pluginsE.g.
QT_QPA_PLATFORM=offscreen
runs your program in headless mode (no screen), which may or may not be useful for testing.
From the docs:
Qt integrates with the windowing system on the target platform using Qt Platform Abstraction (QPA). QPA is an abstraction of a windowing system which makes porting Qt to new platforms simple and quick. One such system is the Wayland protocol. Qt can be used together with Wayland as a light-weight windowing system on embedded hardware to support a multi-process graphical user interface.
The Qt Platform Abstraction uses Qt's plugin system. This plugin system provides APIs to extend Qt in specific areas (such as adding support for new image formats, database drivers, and so on) and also for writing your own extensible Qt applications which support third-party plugins.
Instructions on which values are valid are listed here (though the docs could be improved):
https://doc.qt.io/qt-5/qguiapplication.html#platformName-prop
The
Qt Wiki
seems to have a set of useful environment variable configurations for different setups:https://wiki.qt.io/Qt_6.2_Tools_and_Versions
(b) There's also the `Qt Quick Scene Graph` (`QSG`) and `Rendering Hardware Interface` (`RHI`):
QSG_RHI_BACKEND=software
which you can find more about here:
Qt
QuickControls
(which I've yet to use) list environment variables here:
https://doc.qt.io/qt-5/qtquickcontrols2-environment.html
- For
QMake
(which I haven't used), supported variables are listed here:
https://doc.qt.io/qt-5/qmake-variable-reference.html
- Lastly, there's also a list of all available environment variables for
Qt5
here on GitHub:
https://github.com/pyqt/python-qt5/wiki/Qt-Environment-Variable-Reference
- Most variables/enums for Qt are in