Qt プラットフォーム抽象化

Qt Platform Abstraction (QPA) は、Qt の主要なプラットフォーム抽象化レイヤーです。

この API は、QPlatform* クラス接頭辞で識別することができ、一般的に次のような高レベルのクラスを実装するために使用されます。 Qt GUIQPlatformWindow QWindowQStyleHint とQStyle を通して公開される、より深いプラットフォームのテーマ化と統合のためのQPlatformTheme などです。

QPA クラスにはソース互換性もバイナリ互換性も保証されていません。つまり、API は開発されたバージョンの Qt でのみ動作することが保証されています。ただし、API の変更はマイナー リリースでのみ行われます。(5.1 や 5.2 など)。

APIの概要

  • ウィンドウシステムの統合
    • QPlatformIntegration
    • QPlatformアクセシビリティ
    • QPlatformBackingStore
    • QPlatformクリップボード
    • Qプラットフォーム・カーソル
    • QPlatformDrag
    • QPlatformFontDatabase
    • QPlatformGraphicsBuffer
    • QPlatformInputContext(プラットフォーム入力コンテキスト
    • QPlatformOffscreenSurface(オフスクリーンサーフェス
    • QPlatformOpenGLContext(プラットフォームオープンGLContext
    • QPlatformScreen
    • QPlatformServices
    • QPlatformSharedGraphicsCache(共有グラフィックスキャッシュ
    • QPlatformSurface
    • QPlatformWindow
  • スタイル/テーマ
    • Qプラットフォーム・テーマ
    • プラットフォーム・パレット
    • プラットフォームフォント
    • テーマのヒント
  • ネイティブのダイアログとメニュー
    • QPlatformDialogHelper
    • QPlatformMenu
    • QPlatformMenuBar
    • QPlatformMenuItem

注: QPA API の他にも、Qt には多くのプラットフォーム抽象化があります。 Qt Coreのイベント ディスパッチャ抽象化や RHI のレンダリング ハードウェア抽象化などです。QPA API は、主にウィンドウ システムの統合と関連サポートに重点を置いています。

QPA プラグイン

上記のインターフェースの具体的な実装は、QPA プラグイン(プラットフォーム・プラグイン)の中にあり、Qt が動作するさまざまなプラットフォームのサポートを追加します。QPA プラグインは、QPlatform* クラスをサブクラス化することで実装されます。

次の表に、使用可能なプラットフォーム・プラグインをまとめます:

プラグイン名プラグイン名説明
qandroidQAndroidPlatformIntegrationAndroid サポート
qbsdfbQBsdFbIntegrationBsdFb サポート
qcocoaQCocoaIntegrationPluginmacOS サポート
qdirect2dQWindowsDirect2DIntegrationPluginqwindows プラグインと似ていますが、ラスターペイントエンジンをQPixmap およびQBackingStore 用の Direct2D ベースのペイントエンジンに置き換えています。
qdirectfbQDirectFbIntegrationPluginDirectFB はサーフェスが中心で、これはQPaintDevice に相当します。
qeglfsQEglFSIntegrationPlugin組み込み Linux デバイス用のEGLFSサポート。
qhaikuQHaikuIntegrationHaiku サポート。
qiosQIOSIntegrationPluginiOS サポート
qlinuxfbQLinuxFbIntegrationPlugin組み込み Linux デバイス用のLinuxFBサポート
qvncQVncIntegrationVNC サポート
qwayland
  • QWaylandIntegrationPlugin
  • QWaylandBrcmEglPlatformIntegrationPlugin
  • QWaylandEglPlatformIntegrationPlugin
  • QWaylandXCompositeEglPlatformIntegrationPlugin
  • QWaylandXCompositeGlxPlatformIntegrationPlugin
Wayland サポート
qwindowsQWindowsIntegrationPluginWindows サポート
qxcbQXcbIntegrationPluginX Window System (X11) サポート

QPA プラグインの選択

Qt は、プラットフォームに応じてデフォルトの QPA プラグインを選択します。環境変数QT_QPA_PLATFORM とコマンドライン引数-platform を使用すると、このデフォルトをオーバーライドできます。詳細については、QGuiApplication を参照してください。

QPA プラグインの作成

現時点では、QPA プラグインの作成に関する詳細なチュートリアル文書はありません。ただし、Qt に同梱されている、テストやその他の特別な目的のための最小限のプラグインが 2 つあり、それを例として使用することができます:

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

qminimal プラグインは、Qt にリンクするツールに使用します。 Qt GUIに対してリンクするが、ウィンドウシステムとの統合を必要としないツールに使用されます(例えば、qmlplugindump )。また、環境変数によって決定されたイメージファイルにウィンドウの内容をダンプするための診断サポートがあります。

© 2025 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.