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

詳細説明

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

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

自動クリッピング

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

その結果、新しく構築されたQPainterQPainter::clipRegion() によって返される値は、ペイントシステムによって使用されるクリップ領域を反映しません。

QPainterQWidget::update()、QWidget::repaint()、QWidget::paintEvent()も参照のこと

メンバ関数ドキュメント

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

更新が必要な矩形を持つ paint イベントオブジェクトを構築する。領域はpaintRect で指定します。

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

更新が必要な領域を持つ paint イベントオブジェクトを構築する。領域はpaintRegion で指定する。

const QRect &QPaintEvent::rect() const

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

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

const QRegion &QPaintEvent::region() const

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

rect() およびQPainter::setClipRegion()も参照

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