このページでは

QPaintDeviceWindow Class

QWindow の利便性を高めるサブクラスであり、QPaintDevice でもあります。詳細...

ヘッダー: #include <QPaintDeviceWindow>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
継承元:QWindow およびQPaintDevice
継承元:

QOpenGLWindow およびQRasterWindow

パブリック関数

void update(const QRect &rect)
void update(const QRegion &region)

パブリック・スロット

void update()

再実装されたプロテクト関数

virtual void paintEvent(QPaintEvent *event) override

詳細な説明

QPaintDeviceWindowは、通常のQWindow と同様ですが、ペイントデバイスとしての機能が追加されています。コンテンツの更新が必要な場合は、仮想関数paintEvent()が呼び出されます。この関数を再実装したサブクラスは、ウィンドウ上でQPainter を簡単に開くことができます。

注:このクラスは アプリケーション内で直接使用することはできません。むしろ、QOpenGLWindow のようなサブクラスの基底クラスとして機能します。

QOpenGLWindowも参照してください 。

メンバ関数のドキュメント

[override virtual protected] void QPaintDeviceWindow::paintEvent(QPaintEvent *event)

QWindow::paintEvent(QPaintEvent *ev) を再実装します。

event パラメータで渡された描画イベントを処理します。

デフォルトの実装では何もしません。描画を行うには、この関数を再実装してください。必要に応じて、event から変更された領域を取得できます。

[slot] void QPaintDeviceWindow::update()

ウィンドウ全体を「変更あり」としてマークし、再描画をスケジュールします。

注: 次のペイントイベントが発生する前にこの関数を再度 呼び出しても、その呼び出しは無視されます。

注: 非表示のウィンドウの場合 、更新はウィンドウが再び表示されるまで延期されます。

注:この スロットは オーバーロードされています。このスロットに接続するには:

// Connect using qOverload:
connect(sender, &SenderClass::signal,
        paintDeviceWindow, qOverload<>(&QPaintDeviceWindow::update));

// Or using a lambda as wrapper:
connect(sender, &SenderClass::signal,
        paintDeviceWindow, [receiver = paintDeviceWindow]() { receiver->update(); });
その他の例やアプローチについては、「オーバーロードされたスロットへの接続」を参照してください。

void QPaintDeviceWindow::update(const QRect &rect)

ウィンドウのrect を「変更あり」としてマークし、再描画をスケジュールします。

注: 次のペイントイベントが発生するまでの間にこの関数が再度 呼び出されても無視されますが、rect は更新対象領域に追加されます。

注: 非表示のウィンドウの場合 、更新はウィンドウが再び表示されるまで延期されます。

void QPaintDeviceWindow::update(const QRegion &region)

ウィンドウのregion を「変更済み」としてマークし、再描画をスケジュールします。

注: 次のペイントイベントが発生する前にこの関数が再度 呼び出されても無視されますが、region は更新対象領域に追加されます。

注: 非表示のウィンドウの場合 、更新はウィンドウが再び表示されるまで延期されます。

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