このページでは

QPaintEvent Class

QPaintEvent クラスには、ペイントイベント用のイベントパラメータが含まれています。詳細...

ヘッダー: #include <QPaintEvent>
CMake: find_package(Qt6 REQUIRED COMPONENTS Gui)
target_link_libraries(mytarget PRIVATE Qt6::Gui)
qmake: QT += gui
継承元: QEvent

パブリック関数

QPaintEvent(const QRect &paintRect)
QPaintEvent(const QRegion &paintRegion)
const QRect &rect() const
const QRegion &region() const

プロテクトされた関数

QPaintEvent(QPaintEvent &&)
QPaintEvent &operator=(QPaintEvent &&)
QPaintEvent &operator=(const QPaintEvent &other)

詳細な説明

Paint イベントは、自身を更新する必要があるウィジェットに送信されます。たとえば、覆い隠していたウィジェットが移動されたために、ウィジェットの一部が露出した場合などです。

このイベントには、更新が必要なregion()と、その領域の境界矩形であるrect()が含まれています。多くのウィジェットはregion()をあまり活用できない上、rect()はregion()よりもはるかに高速である可能性があるため、両方が提供されています。

自動クリッピング

ペイントイベントの処理中、描画はregion()によってクリッピングされます。このクリッピングはQtのペイントシステムによって実行され、ペイントデバイスへの描画に使用されるQPainter に適用される可能性のあるクリッピングとは独立しています。

その結果、新しく構築されたQPainter に対してQPainter::clipRegion()が返す値は、ペイントシステムによって使用されるクリッピング領域を反映したものではありません。

関連項目: QPainter 、QWidget::update()、QWidget::repaint()、およびQWidget::paintEvent()。

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

[explicit] QPaintEvent::QPaintEvent(const QRect &paintRect)

更新が必要な矩形を用いて、ペイントイベントオブジェクトを作成します。領域はpaintRect で指定されます。

[explicit] QPaintEvent::QPaintEvent(const QRegion &paintRegion)

更新が必要な領域を指定して、ペイントイベントオブジェクトを作成します。領域は、paintRegion で指定されます。

[protected delete] QPaintEvent::QPaintEvent(QPaintEvent &&)

QPaintEvent のインスタンスをMoveコンストラクタで生成します。この関数は削除されています。

const QRect &QPaintEvent::rect() const

更新が必要な矩形を返します。

region() およびQPainter::setClipRect()も参照してください 。

const QRegion &QPaintEvent::region() const

更新が必要な領域を返します。

rect() およびQPainter::setClipRegion()も参照してください 。

[protected delete] QPaintEvent &QPaintEvent::operator=(QPaintEvent &&)

other をこのQPaintEvent インスタンスに割り当てます。この関数は削除されます。

[noexcept protected default] QPaintEvent &QPaintEvent::operator=(const QPaintEvent &other)

other をこのQPaintEvent インスタンスにコピーして割り当てます。

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