Qt 平台抽象

QPA 即Qt平台抽象层, 移植自Qt4, 在Qt5中替代QWS。 你可以从这个视频演示中了解它:

QPA – The Qt Platform Abstraction [qt-project.org] by Thomas Senyk.

目前只有很少的QPA的文档。开发一个新平台插件最好的方式是
看其他的插件 [qt.gitorious.net]. 理解它们的API是怎样实现的。
minimal [qt.gitorious.net] 插件是最好的切入点。 xcb,windows,cocoa和qnx插件也在开发和更新中。

QPA插件通过子类化不同的QPlatform*类来实现。QPA中有两个基类:QPlatformIntergration窗口系统集成和QPlatformTheme 深入平台主题和集成。 QStyle 不是QPA的一部分。

QPlatformIntergration 此时(Qt 5 Alpha)提供的API大部分已经稳定。 QPlatformTheme 仍在开发中。QPA类并没有代码和二进制的兼容性保证,意思是一个平台插件只保证在它开发依赖的Qt版本中工作。 但是API的改变只在次发行版中。(5.1, 5.2 等等。)

类概览

  1. QPlatformIntegration
  2.     QPlatformWindow
  3.     QPlatformBackingStore
  4.     QPlatformOpenGLContext
  5.     QPlatformSharedGraphicsCache
  6.     QPlatformFontDatabase
  7.     QPlatformClipboard
  8.     QPlatformDrag
  9.     QPlatformInputContext
  10.     QPlatformAccessibility
  11.     QPlatformNativeInterface
  12.     QPlatformServices
  13.  
  14. QPlatformTheme
  15.     QPlatformMenu
  16.     QPlatformMenuBar
  17.     QPlatformDialogHelper
  18.     platform palettes
  19.     platform fonts
  20.     theme hints

src/platformsupport [qt.gitorious.net] 包含了几个在类unix(unix-like)系统中实现平台插件有帮助的类。

各个QPA类的基础介绍在这篇博客上 post [qforever.wordpress.com] .

Categories: