知方号

知方号

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

API OverviewWindow system integrationQPlatformIntegrationQPlatformAccessibilityQPlatformBackingStoreQPlatformClipboardQPlatformCursorQPlatformDragQPlatformFontDatabaseQPlatformGraphicsBufferQPlatformInputContextQPlatformOffscreenSurfaceQPlatformOpenGLContextQPlatformScreenQPlatformServicesQPlatformSharedGraphicsCacheQPlatformSurfaceQPlatformWindowStyle/themingQPlatformThemeplatform palettesplatform fontstheme hintsNative dialogs and menusQPlatformDialogHelperQPlatformMenuQPlatformMenuBarQPlatformMenuItem

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.

QPA Plugins

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 QPlatform* classes.

The following table summarizes the platform plugins available:

Plugin NamePlugin Class NameDescriptionqandroidQAndroidPlatformIntegrationAndroid supportqbsdfbQBsdFbIntegrationBsdFb supportqcocoaQCocoaIntegrationPluginmacOS supportqdirect2dQWindowsDirect2DIntegrationPluginSimilar to the qwindows plugin, but replaces the raster paint engine with a Direct2D-based paint engine for QPixmap and QBackingStore.qdirectfbQDirectFbIntegrationPluginDirectFB is centered around surfaces, which are the equivalent of a QPaintDevice.qeglfsQEglFSIntegrationPluginEGLFS support for embedded Linux devices.qhaikuQHaikuIntegrationHaiku supportqiosQIOSIntegrationPluginiOS supportqlinuxfbQLinuxFbIntegrationPluginLinuxFB support for embedded Linux devices.qvncQVncIntegrationVNC supportqwaylandQWaylandIntegrationPluginQWaylandBrcmEglPlatformIntegrationPluginQWaylandEglPlatformIntegrationPluginQWaylandXCompositeEglPlatformIntegrationPluginQWaylandXCompositeGlxPlatformIntegrationPluginWayland supportqwindowsQWindowsIntegrationPluginWindows supportqxcbQXcbIntegrationPluginX Window System (X11) supportSelecting a QPA plugin

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.

Writing a QPA plugin

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:

qtbase/src/plugins/platforms/minimal/qtbase/src/plugins/platforms/minimalegl/

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

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至lizi9903@foxmail.com举报,一经查实,本站将立刻删除。

上一篇 没有了

下一篇没有了