返回介绍

QPaintEvent Class

发布于 2019-10-04 15:01:56 字数 2761 浏览 1279 评论 0 收藏 0

The QPaintEvent class contains event parameters for paint events. More...

#include <qevent.h>

Inherits QEvent.

List of all member functions.

Public Members

  • QPaintEvent ( constQRegion&paintRegion, boolerased = TRUE )
  • QPaintEvent ( constQRect&paintRect, boolerased = TRUE )
  • const QRect & rect () const
  • const QRegion & region () const
  • bool erased () const

Detailed Description

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 is 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 can't make much use of region(), and rect() can be much faster than region().boundingRect(). Painting is clipped to region() during processing of a paint event.

The erased() function returns TRUE if the region() has been cleared to the widget's background (see QWidget::backgroundMode()), and FALSE if the region's contents are arbitrary.

See also QPainter, QWidget::update(), QWidget::repaint(), QWidget::paintEvent(), QWidget::backgroundMode, QRegion and Event Classes.


Member Function Documentation

QPaintEvent::QPaintEvent ( constQRegion&paintRegion, boolerased = TRUE )

Constructs a paint event object with the region that should be updated. The region is given by paintRegion. If erased is TRUE the region will be cleared before repainting.

QPaintEvent::QPaintEvent ( constQRect&paintRect, boolerased = TRUE )

Constructs a paint event object with the rectangle that should be updated. The region is given by paintRect. If erased is TRUE the region will be cleared before repainting.

bool QPaintEvent::erased () const

Returns TRUE if the paint event region (or rectangle) has been erased with the widget's background; otherwise returns FALSE.

constQRect& QPaintEvent::rect () const

Returns the rectangle that should be updated.

See also region() and QPainter::setClipRect().

Examples: life/life.cpp, qfd/fontdisplayer.cpp, showimg/showimg.cpp, t10/cannon.cpp, t11/cannon.cpp, t13/cannon.cpp and tooltip/tooltip.cpp.

constQRegion& QPaintEvent::region () const

Returns the region that should be updated.

See also rect() and QPainter::setClipRegion().

Examples: qfd/fontdisplayer.cpp and scribble/scribble.cpp.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文