<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qevent.cpp --> <title>QPaintEvent Class | Qt GUI 5.12.2</title> <link rel="stylesheet" type="text/css" href="style/offline-simple.css" /> <script type="text/javascript"> document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css"); // loading style sheet breaks anchors that were jumped to before // so force jumping to anchor again setTimeout(function() { var anchor = location.hash; // need to jump to different anchor first (e.g. none) location.hash = "#"; setTimeout(function() { location.hash = anchor; }, 0); }, 0); </script> </head> <body> <div class="header" id="qtdocheader"> <div class="main"> <div class="main-rounded"> <div class="navigationbar"> <table><tr> <td >Qt 5.12</td><td ><a href="qtgui-index.html">Qt GUI</a></td><td ><a href="qtgui-module.html">C++ Classes</a></td><td >QPaintEvent</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right"><a href="qtgui-index.html">Qt 5.12.2 Reference Documentation</a></td> </tr></table> </div> </div> <div class="content"> <div class="line"> <div class="content mainContent"> <div class="sidebar"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#protected-variables">Protected Variables</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> <li class="level2"><a href="#automatic-clipping">Automatic Clipping</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QPaintEvent Class</h1> <!-- $$$QPaintEvent-brief --> <p>The <a href="qpaintevent.html">QPaintEvent</a> class contains event parameters for paint events. <a href="#details">More...</a></p> <!-- @@@QPaintEvent --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QPaintEvent></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += gui</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="../qtcore/qevent.html">QEvent</a></td></tr></table></div><ul> <li><a href="qpaintevent-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h2 id="public-functions">Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpaintevent.html#QPaintEvent">QPaintEvent</a></b>(const QRegion &<i>paintRegion</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qpaintevent.html#QPaintEvent-1">QPaintEvent</a></b>(const QRect &<i>paintRect</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const QRect &</td><td class="memItemRight bottomAlign"><b><a href="qpaintevent.html#rect">rect</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const QRegion &</td><td class="memItemRight bottomAlign"><b><a href="qpaintevent.html#region">region</a></b>() const</td></tr> </table></div> <ul> <li class="fn">6 public functions inherited from <a href="../qtcore/qevent.html#public-functions">QEvent</a></li> </ul> <a name="protected-variables"></a> <h2 id="protected-variables">Protected Variables</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qpaintevent.html#m_erased-var">m_erased</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QRect </td><td class="memItemRight bottomAlign"><b><a href="qpaintevent.html#m_rect-var">m_rect</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QRegion </td><td class="memItemRight bottomAlign"><b><a href="qpaintevent.html#m_region-var">m_region</a></b></td></tr> </table></div> <h3>Additional Inherited Members</h3> <ul> <li class="fn">1 property inherited from <a href="../qtcore/qevent.html#properties">QEvent</a></li> <li class="fn">1 static public member inherited from <a href="../qtcore/qevent.html#static-public-members">QEvent</a></li> </ul> <a name="details"></a> <!-- $$$QPaintEvent-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qpaintevent.html">QPaintEvent</a> class contains event parameters for paint events.</p> <p>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.</p> <p>The event contains a <a href="qpaintevent.html#region">region</a>() that needs to be updated, and a <a href="qpaintevent.html#rect">rect</a>() that is the bounding rectangle of that region. Both are provided because many widgets cannot make much use of <a href="qpaintevent.html#region">region</a>(), and <a href="qpaintevent.html#rect">rect</a>() can be much faster than <a href="qpaintevent.html#region">region</a>().boundingRect().</p> <a name="automatic-clipping"></a> <h3 >Automatic Clipping</h3> <p>Painting is clipped to <a href="qpaintevent.html#region">region</a>() 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 <a href="qpainter.html">QPainter</a> used to draw on the paint device.</p> <p>As a result, the value returned by <a href="qpainter.html#clipRegion">QPainter::clipRegion</a>() on a newly-constructed <a href="qpainter.html">QPainter</a> will not reflect the clip region that is used by the paint system.</p> </div> <p><b>See also </b><a href="qpainter.html">QPainter</a>, <a href="../qtwidgets/qwidget.html#update">QWidget::update</a>(), <a href="../qtwidgets/qwidget.html#repaint">QWidget::repaint</a>(), and <a href="../qtwidgets/qwidget.html#paintEvent">QWidget::paintEvent</a>().</p> <!-- @@@QPaintEvent --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QPaintEvent[overload1]$$$QPaintEventconstQRegion& --> <h3 class="fn" id="QPaintEvent"><a name="QPaintEvent"></a>QPaintEvent::<span class="name">QPaintEvent</span>(const <span class="type"><a href="qregion.html">QRegion</a></span> &<i>paintRegion</i>)</h3> <p>Constructs a paint event object with the region that needs to be updated. The region is specified by <i>paintRegion</i>.</p> <!-- @@@QPaintEvent --> <!-- $$$QPaintEvent$$$QPaintEventconstQRect& --> <h3 class="fn" id="QPaintEvent-1"><a name="QPaintEvent-1"></a>QPaintEvent::<span class="name">QPaintEvent</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &<i>paintRect</i>)</h3> <p>Constructs a paint event object with the rectangle that needs to be updated. The region is specified by <i>paintRect</i>.</p> <!-- @@@QPaintEvent --> <!-- $$$rect[overload1]$$$rect --> <h3 class="fn" id="rect"><a name="rect"></a>const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &QPaintEvent::<span class="name">rect</span>() const</h3> <p>Returns the rectangle that needs to be updated.</p> <p><b>See also </b><a href="qpaintevent.html#region">region</a>() and <a href="qpainter.html#setClipRect">QPainter::setClipRect</a>().</p> <!-- @@@rect --> <!-- $$$region[overload1]$$$region --> <h3 class="fn" id="region"><a name="region"></a>const <span class="type"><a href="qregion.html">QRegion</a></span> &QPaintEvent::<span class="name">region</span>() const</h3> <p>Returns the region that needs to be updated.</p> <p><b>See also </b><a href="qpaintevent.html#rect">rect</a>() and <a href="qpainter.html#setClipRegion">QPainter::setClipRegion</a>().</p> <!-- @@@region --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2019 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.<br/> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.<br/> 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. </p> </div> </body> </html>