<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qgraphicsitem.cpp --> <title>QGraphicsPathItem Class | Qt Widgets 5.9</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.9</td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QGraphicsPathItem</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</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="#reimplemented-public-functions">Reimplemented Public Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QGraphicsPathItem Class</h1> <!-- $$$QGraphicsPathItem-brief --> <p>The <a href="qgraphicspathitem.html">QGraphicsPathItem</a> class provides a path item that you can add to a <a href="qgraphicsscene.html">QGraphicsScene</a>. <a href="#details">More...</a></p> <!-- @@@QGraphicsPathItem --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QGraphicsPathItem></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 4.2</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qabstractgraphicsshapeitem.html">QAbstractGraphicsShapeItem</a></td></tr></table></div><ul> <li><a href="qgraphicspathitem-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="qgraphicspathitem.html#QGraphicsPathItem">QGraphicsPathItem</a></b>(QGraphicsItem *<i>parent</i> = Q_NULLPTR)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qgraphicspathitem.html#QGraphicsPathItem-1">QGraphicsPathItem</a></b>(const QPainterPath &<i>path</i>, QGraphicsItem *<i>parent</i> = Q_NULLPTR)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qgraphicspathitem.html#dtor.QGraphicsPathItem">~QGraphicsPathItem</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qgraphicspathitem.html#path">path</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicspathitem.html#setPath">setPath</a></b>(const QPainterPath &<i>path</i>)</td></tr> </table></div> <a name="reimplemented-public-functions"></a> <h2 id="reimplemented-public-functions">Reimplemented Public Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> virtual QRectF </td><td class="memItemRight bottomAlign"><b><a href="qgraphicspathitem.html#boundingRect">boundingRect</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicspathitem.html#contains">contains</a></b>(const QPointF &<i>point</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicspathitem.html#isObscuredBy">isObscuredBy</a></b>(const QGraphicsItem *<i>item</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qgraphicspathitem.html#opaqueArea">opaqueArea</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicspathitem.html#paint">paint</a></b>(QPainter *<i>painter</i>, const QStyleOptionGraphicsItem *<i>option</i>, QWidget *<i>widget</i> = Q_NULLPTR)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qgraphicspathitem.html#shape">shape</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qgraphicspathitem.html#type">type</a></b>() const</td></tr> </table></div> <ul> <li class="fn">6 public functions inherited from <a href="qabstractgraphicsshapeitem.html#public-functions">QAbstractGraphicsShapeItem</a></li> <li class="fn">176 public functions inherited from <a href="qgraphicsitem.html#public-functions">QGraphicsItem</a></li> </ul> <h3>Additional Inherited Members</h3> <ul> <li class="fn">2 static public members inherited from <a href="qgraphicsitem.html#static-public-members">QGraphicsItem</a></li> <li class="fn">24 protected functions inherited from <a href="qgraphicsitem.html#protected-functions">QGraphicsItem</a></li> </ul> <a name="details"></a> <!-- $$$QGraphicsPathItem-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qgraphicspathitem.html">QGraphicsPathItem</a> class provides a path item that you can add to a <a href="qgraphicsscene.html">QGraphicsScene</a>.</p> <p>To set the item's path, pass a <a href="../qtgui/qpainterpath.html">QPainterPath</a> to <a href="qgraphicspathitem.html">QGraphicsPathItem</a>'s constructor, or call the <a href="qgraphicspathitem.html#setPath">setPath</a>() function. The <a href="qgraphicspathitem.html#path">path</a>() function returns the current path.</p> <p class="centerAlign"><img src="images/graphicsview-pathitem.png" alt="" /></p><p><a href="qgraphicspathitem.html">QGraphicsPathItem</a> uses the path to provide a reasonable implementation of <a href="qgraphicspathitem.html#boundingRect">boundingRect</a>(), <a href="qgraphicspathitem.html#shape">shape</a>(), and <a href="qgraphicspathitem.html#contains">contains</a>(). The <a href="qgraphicspathitem.html#paint">paint</a>() function draws the path using the item's associated pen and brush, which you can set by calling the <a href="qabstractgraphicsshapeitem.html#setPen">setPen</a>() and <a href="qabstractgraphicsshapeitem.html#setBrush">setBrush</a>() functions.</p> </div> <p><b>See also </b><a href="qgraphicsrectitem.html">QGraphicsRectItem</a>, <a href="qgraphicsellipseitem.html">QGraphicsEllipseItem</a>, <a href="qgraphicspolygonitem.html">QGraphicsPolygonItem</a>, <a href="qgraphicstextitem.html">QGraphicsTextItem</a>, <a href="qgraphicslineitem.html">QGraphicsLineItem</a>, <a href="qgraphicspixmapitem.html">QGraphicsPixmapItem</a>, and <a href="graphicsview.html">Graphics View Framework</a>.</p> <!-- @@@QGraphicsPathItem --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QGraphicsPathItem[overload1]$$$QGraphicsPathItemQGraphicsItem* --> <h3 class="fn" id="QGraphicsPathItem"><a name="QGraphicsPathItem"></a>QGraphicsPathItem::<span class="name">QGraphicsPathItem</span>(<span class="type"><a href="qgraphicsitem.html#QGraphicsItem">QGraphicsItem</a></span> *<i>parent</i> = Q_NULLPTR)</h3> <p>Constructs a QGraphicsPath. <i>parent</i> is passed to <a href="qabstractgraphicsshapeitem.html">QAbstractGraphicsShapeItem</a>'s constructor.</p> <p><b>See also </b><a href="qgraphicsscene.html#addItem">QGraphicsScene::addItem</a>().</p> <!-- @@@QGraphicsPathItem --> <!-- $$$QGraphicsPathItem$$$QGraphicsPathItemconstQPainterPath&QGraphicsItem* --> <h3 class="fn" id="QGraphicsPathItem-1"><a name="QGraphicsPathItem-1"></a>QGraphicsPathItem::<span class="name">QGraphicsPathItem</span>(const <span class="type"><a href="../qtgui/qpainterpath.html">QPainterPath</a></span> &<i>path</i>, <span class="type"><a href="qgraphicsitem.html#QGraphicsItem">QGraphicsItem</a></span> *<i>parent</i> = Q_NULLPTR)</h3> <p>Constructs a QGraphicsPath item using <i>path</i> as the default path. <i>parent</i> is passed to <a href="qabstractgraphicsshapeitem.html">QAbstractGraphicsShapeItem</a>'s constructor.</p> <p><b>See also </b><a href="qgraphicsscene.html#addItem">QGraphicsScene::addItem</a>().</p> <!-- @@@QGraphicsPathItem --> <!-- $$$~QGraphicsPathItem[overload1]$$$~QGraphicsPathItem --> <h3 class="fn" id="dtor.QGraphicsPathItem"><a name="dtor.QGraphicsPathItem"></a>QGraphicsPathItem::<span class="name">~QGraphicsPathItem</span>()</h3> <p>Destroys the <a href="qgraphicspathitem.html">QGraphicsPathItem</a>.</p> <!-- @@@~QGraphicsPathItem --> <!-- $$$boundingRect[overload1]$$$boundingRect --> <h3 class="fn" id="boundingRect"><a name="boundingRect"></a><code>[virtual] </code><span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> QGraphicsPathItem::<span class="name">boundingRect</span>() const</h3> <p>Reimplemented from <a href="qgraphicsitem.html#boundingRect">QGraphicsItem::boundingRect</a>().</p> <!-- @@@boundingRect --> <!-- $$$contains[overload1]$$$containsconstQPointF& --> <h3 class="fn" id="contains"><a name="contains"></a><code>[virtual] </code><span class="type">bool</span> QGraphicsPathItem::<span class="name">contains</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &<i>point</i>) const</h3> <p>Reimplemented from <a href="qgraphicsitem.html#contains">QGraphicsItem::contains</a>().</p> <!-- @@@contains --> <!-- $$$isObscuredBy[overload1]$$$isObscuredByconstQGraphicsItem* --> <h3 class="fn" id="isObscuredBy"><a name="isObscuredBy"></a><code>[virtual] </code><span class="type">bool</span> QGraphicsPathItem::<span class="name">isObscuredBy</span>(const <span class="type"><a href="qgraphicsitem.html#QGraphicsItem">QGraphicsItem</a></span> *<i>item</i>) const</h3> <p>Reimplemented from <a href="qgraphicsitem.html#isObscuredBy">QGraphicsItem::isObscuredBy</a>().</p> <!-- @@@isObscuredBy --> <!-- $$$opaqueArea[overload1]$$$opaqueArea --> <h3 class="fn" id="opaqueArea"><a name="opaqueArea"></a><code>[virtual] </code><span class="type"><a href="../qtgui/qpainterpath.html">QPainterPath</a></span> QGraphicsPathItem::<span class="name">opaqueArea</span>() const</h3> <p>Reimplemented from <a href="qgraphicsitem.html#opaqueArea">QGraphicsItem::opaqueArea</a>().</p> <!-- @@@opaqueArea --> <!-- $$$paint[overload1]$$$paintQPainter*constQStyleOptionGraphicsItem*QWidget* --> <h3 class="fn" id="paint"><a name="paint"></a><code>[virtual] </code><span class="type">void</span> QGraphicsPathItem::<span class="name">paint</span>(<span class="type"><a href="../qtgui/qpainter.html">QPainter</a></span> *<i>painter</i>, const <span class="type"><a href="qstyleoptiongraphicsitem.html">QStyleOptionGraphicsItem</a></span> *<i>option</i>, <span class="type"><a href="qwidget.html">QWidget</a></span> *<i>widget</i> = Q_NULLPTR)</h3> <p>Reimplemented from <a href="qgraphicsitem.html#paint">QGraphicsItem::paint</a>().</p> <!-- @@@paint --> <!-- $$$path[overload1]$$$path --> <h3 class="fn" id="path"><a name="path"></a><span class="type"><a href="../qtgui/qpainterpath.html">QPainterPath</a></span> QGraphicsPathItem::<span class="name">path</span>() const</h3> <p>Returns the item's path as a <a href="../qtgui/qpainterpath.html">QPainterPath</a>. If no item has been set, an empty <a href="../qtgui/qpainterpath.html">QPainterPath</a> is returned.</p> <p><b>See also </b><a href="qgraphicspathitem.html#setPath">setPath</a>().</p> <!-- @@@path --> <!-- $$$setPath[overload1]$$$setPathconstQPainterPath& --> <h3 class="fn" id="setPath"><a name="setPath"></a><span class="type">void</span> QGraphicsPathItem::<span class="name">setPath</span>(const <span class="type"><a href="../qtgui/qpainterpath.html">QPainterPath</a></span> &<i>path</i>)</h3> <p>Sets the item's path to be the given <i>path</i>.</p> <p><b>See also </b><a href="qgraphicspathitem.html#path">path</a>().</p> <!-- @@@setPath --> <!-- $$$shape[overload1]$$$shape --> <h3 class="fn" id="shape"><a name="shape"></a><code>[virtual] </code><span class="type"><a href="../qtgui/qpainterpath.html">QPainterPath</a></span> QGraphicsPathItem::<span class="name">shape</span>() const</h3> <p>Reimplemented from <a href="qgraphicsitem.html#shape">QGraphicsItem::shape</a>().</p> <!-- @@@shape --> <!-- $$$type[overload1]$$$type --> <h3 class="fn" id="type"><a name="type"></a><code>[virtual] </code><span class="type">int</span> QGraphicsPathItem::<span class="name">type</span>() const</h3> <p>Reimplemented from <a href="qgraphicsitem.html#type">QGraphicsItem::type</a>().</p> <!-- @@@type --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2017 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>