Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    List of Qt and QML environment variables

    General and Desktop
    2
    2
    2731
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • J
      JapieKrekel last edited by

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

      1 Reply Last reply Reply Quote 2
      • A
        adamhendry last edited by

        1. 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 for Widget Attribute: QtCore.Qt.WidgetAttribute
        (b) AA stands for Application Attribute: .QtCore.Qt.ApplicationAttribute

        These are used within code and set with QAppliction.setAttribute and tested with QApplication.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.

        1. Environment variables are often used for specific plugins and abstractions. For example

          (a) QPA stand for Qt Platform Abstraction, which controls the platform/windowing mode your app uses: https://doc.qt.io/qt-5/qpa.html#qpa-plugins

          E.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:

        https://doc.qt.io/qt-5/qtquick-visualcanvas-scenegraph-renderer.html#rendering-via-the-qt-rendering-hardware-interface

        1. Qt QuickControls (which I've yet to use) list environment variables here:

        https://doc.qt.io/qt-5/qtquickcontrols2-environment.html

        1. For QMake (which I haven't used), supported variables are listed here:

        https://doc.qt.io/qt-5/qmake-variable-reference.html

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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post