Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Qt Environment Variables

Qt Environment Variables

Scheduled Pinned Locked Moved Solved General and Desktop
1 Posts 1 Posters 5.9k Views
  • 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.
  • A Offline
    A Offline
    adamhendry
    wrote on last edited by adamhendry
    #1

    Posting this here for posterity (including my future self). This has been asked many times, but most noteably:

    1. https://forum.qt.io/topic/28853/list-of-qt-and-qml-environment-variables/2
    2. Here: https://forum.qt.io/topic/37773/environment-variables

    Answer

    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
    1

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved