QPaintEvent Class

The QPaintEvent class contains event parameters for paint events. 更多...

头文件: #include <QPaintEvent>
qmake: QT += gui
基类: QEvent

公有函数

QPaintEvent(const QRegion &paintRegion)
QPaintEvent(const QRect &paintRect)
const QRect &rect() const
const QRegion &region() const
  • 6 个公有函数继承自 QEvent

其他继承的成员

  • 1 个属性继承自 QEvent
  • 1 个静态公有成员继承自 QEvent
  • 2 个受保护的变量继承自 QEvent

详细描述

The QPaintEvent class contains event parameters for paint events.

Paint events are sent to widgets that need to update themselves, for instance when part of a widget is exposed because a covering widget was moved.

The event contains a region() that needs to be updated, and a rect() that is the bounding rectangle of that region. Both are provided because many widgets cannot make much use of region(), and rect() can be much faster than region().boundingRect().

Automatic Clipping

Painting is clipped to region() during the processing of a paint event. This clipping is performed by Qt's paint system and is independent of any clipping that may be applied to a QPainter used to draw on the paint device.

As a result, the value returned by QPainter::clipRegion() on a newly-constructed QPainter will not reflect the clip region that is used by the paint system.

参见 QPainter, QWidget::update(), QWidget::repaint(), and QWidget::paintEvent().

成员函数

QPaintEvent::QPaintEvent(const QRegion &paintRegion)

Constructs a paint event object with the region that needs to be updated. The region is specified by paintRegion.

QPaintEvent::QPaintEvent(const QRect &paintRect)

Constructs a paint event object with the rectangle that needs to be updated. The region is specified by paintRect.

const QRect &QPaintEvent::rect() const

Returns the rectangle that needs to be updated.

参见 region() and QPainter::setClipRect().

const QRegion &QPaintEvent::region() const

Returns the region that needs to be updated.

参见 rect() and QPainter::setClipRegion().