Qt Platform Abstraction/zh

From Qt Wiki
Jump to navigation Jump to search


h1. Qt 平台抽象

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

"QPA - The Qt Platform Abstraction":http://qt.io/videos/watch/qpa-the-qt-platform-abstraction by Thomas Senyk.

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

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

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

类概览

QPlatformIntegration<br /> QPlatformWindow<br /> QPlatformBackingStore<br /> QPlatformOpenGLContext<br /> QPlatformSharedGraphicsCache<br /> QPlatformFontDatabase<br /> QPlatformClipboard<br /> QPlatformDrag<br /> QAbstractEventDispatcher<br /> QPlatformInputContext<br /> QPlatformAccessibility<br /> QPlatformNativeInterface<br /> QPlatformServices

QPlatformTheme<br /> QPlatformMenu<br /> QPlatformMenuBar<br /> QPlatformDialogHelper<br /> platform palettes<br /> platform fonts<br /> theme hints

"src/platformsupport&quot;:http://qt.gitorious.net/qt/qtbase/trees/master/src/platformsupport 包含了几个在类unix(unix-like)系统中实现平台插件有帮助的类。