Qt Platform Abstraction

QPA (Qt 平台抽象) 是用于 Qt 5 和替换 Qt for Embedded Linux 及 Qt 4 平台端口的平台抽象层。

QPA 插件的实现是通过子类化各种 QPlatform* 类。有几个 root 类,譬如 QPlatformIntegration and QPlatformWindow 用于窗口系统集成和 QPlatformTheme 用于更深入的平台主题和集成。 QStyle 不属于 QPA。

QPA 类没有源代码或二进制兼容性保证,意味着平台插件只保证与它所开发的 Qt 版本能一起工作。不管怎样,只会在子发行中更改 API (如 5.1、5.2 等)。

QPA 最小插件

目前还没有编写 QPA 插件的详细教程文档编制。不管怎样,Qt 5 随附了 2 个用于测试和其它特殊目的的最小插件,可以用作范例:

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

qminimal 插件是工具用于链接到 Qt GUI ,但不要求窗口系统集成 (例如, qmlplugindump )。它还拥有诊断支持,可以通过环境变量确定把窗口内容转储到图像文件。

类概述

  • QPlatformIntegration
    • QAbstractEventDispatcher
    • QPlatformAccessibility
    • QPlatformBackingStore
    • QPlatformClipboard
    • QPlatformCursor
    • QPlatformDrag
    • QPlatformFontDatabase
    • QPlatformGraphicsBuffer
    • QPlatformInputContext
    • QPlatformNativeInterface
    • QPlatformOffscreenSurface
    • QPlatformOpenGLContext
    • QPlatformScreen
    • QPlatformServices
    • QPlatformSharedGraphicsCache
    • QPlatformSurface
    • QPlatformWindow
  • QPlatformTheme
    • QPlatformDialogHelper
    • QPlatformMenu
    • QPlatformMenuBar
    • QPlatformMenuItem
    • QPlatformSystemTrayIcon
    • platform palettes
    • platform fonts
    • theme hints

qtbase/src/platformsupport 包含几个帮助程序类,用于实现像 Unix 系统平台插件。

QPA 插件

下表汇总可用于 QPA 的平台插件:

插件名称 插件类名称 描述
qandroid QAndroidPlatformIntegration Android 支持
qbsdfb QBsdFbIntegration BsdFb 支持
qcocoa QCocoaIntegrationPlugin Cocoa 支持
qdirect2d QWindowsDirect2DIntegrationPlugin 类似 qwindows 插件,但采用基于 Direct2D 的描绘引擎替换光栅描绘引擎为 QPixmap and QBackingStore .
qdirectfb QDirectFbIntegrationPlugin DirectFB 中心围绕 surfaces ,相当于 QPaintDevice .
qeglfs QEglFSIntegrationPlugin EGLFS 支持嵌入式 Linux 设备。
qhaiku QHaikuIntegration Haiku 支持
qios QIOSIntegrationPlugin iOS 支持
qlinuxfb QLinuxFbIntegrationPlugin LinuxFB 支持嵌入式 Linux 设备。
qmirclient QMirClientIntegration Mir 客户端支持
qopenwf QOpenWFDIntegrationPlugin OpenWF Display 支持管理显示控制硬件。
qqnx QQnxIntegrationPlugin QNX 支持
qvnc QVncIntegration VNC 支持
qwayland
  • QWaylandIntegrationPlugin
  • QWaylandBrcmEglPlatformIntegrationPlugin
  • QWaylandEglPlatformIntegrationPlugin
  • QWaylandXCompositeEglPlatformIntegrationPlugin
  • QWaylandXCompositeGlxPlatformIntegrationPlugin
Wayland 支持
qwindows QWindowsIntegrationPlugin Windows 支持
qwinrt QWinRTIntegrationPlugin WinRT 和 Windows Phone 支持
qxcb QXcbIntegrationPlugin X 窗口系统 (X11) 支持
webgl QWebGLIntegrationPlugin WebGL 支持 Qt Quick 应用程序