Qt Platform Abstraction
The Qt Platform Abstraction (QPA) is the main platform abstraction layer in Qt.
The API can be identified by the
QPlatform* class prefix, and is used for implementing higher level classes typically found in Qt GUI, e.g.
QPlatformWindow for window system integration exposed through QWindow, or
QPlatformTheme for deeper platform theming and integration, exposed through QStyleHint and QStyle.
There are no source or binary compatibility guarantees for the QPA classes, meaning that the API is only guaranteed to work with the Qt version it was developed against. API changes will however only be made in minor releases. (5.1, 5.2, and so on.)
- Window system integration
- platform palettes
- platform fonts
- theme hints
- Native dialogs and menus
Note: In addition to the QPA APIs, there are many other platform abstractions in Qt, for example the event dispatcher abstractions in Qt Core and the rendering hardware abstractions in RHI. The QPA APIs are mostly focused on window system integration and related support.
Concrete implementations of the interfaces listed above live in QPA plugins, or platform plugins, adding support for the various platforms Qt runs on. QPA plugins are implemented by subclassing the
The following table summarizes the platform plugins available:
|Plugin Name||Plugin Class Name||Description|
|QWindowsDirect2DIntegrationPlugin||Similar to the |
|QDirectFbIntegrationPlugin||DirectFB is centered around surfaces, which are the equivalent of a QPaintDevice.|
|QEglFSIntegrationPlugin||EGLFS support for embedded Linux devices.|
|QLinuxFbIntegrationPlugin||LinuxFB support for embedded Linux devices.|
|QMirClientIntegration||Mir client support|
|QOpenWFDIntegrationPlugin||OpenWF Display support for managing display control hardware.|
|QXcbIntegrationPlugin||X Window System (X11) support|
Qt will select a default QPA plugin, depending on the platform. The
QT_QPA_PLATFORM environment variable and the
-platform command line argument allow you to override this default. See QGuiApplication for more details.
There is no detailed tutorial documentation for writing QPA plugins at this time. However, there are two minimal plugins shipped with Qt for testing and other special purposes that you can use as examples:
qminimal plugin is used for tools that link against Qt GUI, but do not require window system integration (for example,
qmlplugindump). It also has diagnostic support for dumping window contents to image files as determined by environment variables.
© 2022 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.