Sophie

Sophie

distrib > Mageia > 7 > armv7hl > media > core-updates > by-pkgid > d5e62c01ae8d1e579463c6a871dd44bf > files > 3835

qtbase5-doc-5.12.6-2.mga7.noarch.rpm

<?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>QGraphicsRectItem Class | Qt Widgets 5.12.6</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="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QGraphicsRectItem</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right"><a href="qtwidgets-index.html">Qt 5.12.6 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-types">Public Types</a></li>
<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">QGraphicsRectItem Class</h1>
<!-- $$$QGraphicsRectItem-brief -->
<p>The <a href="qgraphicsrectitem.html">QGraphicsRectItem</a> class provides a rectangle item that you can add to a <a href="qgraphicsscene.html">QGraphicsScene</a>. <a href="#details">More...</a></p>
<!-- @@@QGraphicsRectItem -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QGraphicsRectItem&gt;</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="qgraphicsrectitem-members.html">List of all members, including inherited members</a></li>
<li><a href="qgraphicsrectitem-obsolete.html">Obsolete members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsrectitem.html#anonymous-enum">anonymous</a></b> { Type }</td></tr>
</table></div>
<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="qgraphicsrectitem.html#QGraphicsRectItem">QGraphicsRectItem</a></b>(QGraphicsItem *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsrectitem.html#QGraphicsRectItem-1">QGraphicsRectItem</a></b>(const QRectF &amp;<i>rect</i>, QGraphicsItem *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsrectitem.html#QGraphicsRectItem-2">QGraphicsRectItem</a></b>(qreal <i>x</i>, qreal <i>y</i>, qreal <i>width</i>, qreal <i>height</i>, QGraphicsItem *<i>parent</i> = nullptr)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsrectitem.html#dtor.QGraphicsRectItem">~QGraphicsRectItem</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QRectF </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsrectitem.html#rect">rect</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsrectitem.html#setRect">setRect</a></b>(const QRectF &amp;<i>rectangle</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsrectitem.html#setRect-1">setRect</a></b>(qreal <i>x</i>, qreal <i>y</i>, qreal <i>width</i>, qreal <i>height</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="qgraphicsrectitem.html#boundingRect">boundingRect</a></b>() const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsrectitem.html#contains">contains</a></b>(const QPointF &amp;<i>point</i>) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsrectitem.html#isObscuredBy">isObscuredBy</a></b>(const QGraphicsItem *<i>item</i>) const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsrectitem.html#opaqueArea">opaqueArea</a></b>() const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsrectitem.html#paint">paint</a></b>(QPainter *<i>painter</i>, const QStyleOptionGraphicsItem *<i>option</i>, QWidget *<i>widget</i> = nullptr) override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QPainterPath </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsrectitem.html#shape">shape</a></b>() const override</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qgraphicsrectitem.html#type">type</a></b>() const override</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">24 protected functions inherited from <a href="qgraphicsitem.html#protected-functions">QGraphicsItem</a></li>
</ul>
<a name="details"></a>
<!-- $$$QGraphicsRectItem-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qgraphicsrectitem.html">QGraphicsRectItem</a> class provides a rectangle item that you can add to a <a href="qgraphicsscene.html">QGraphicsScene</a>.</p>
<p>To set the item's rectangle, pass a <a href="../qtcore/qrectf.html">QRectF</a> to <a href="qgraphicsrectitem.html">QGraphicsRectItem</a>'s constructor, or call the <a href="qgraphicsrectitem.html#setRect">setRect</a>() function. The <a href="qgraphicsrectitem.html#rect">rect</a>() function returns the current rectangle.</p>
<p class="centerAlign"><img src="images/graphicsview-rectitem.png" alt="" /></p><p><a href="qgraphicsrectitem.html">QGraphicsRectItem</a> uses the rectangle and the pen width to provide a reasonable implementation of <a href="qgraphicsrectitem.html#boundingRect">boundingRect</a>(), <a href="qgraphicsrectitem.html#shape">shape</a>(), and <a href="qgraphicsrectitem.html#contains">contains</a>(). The <a href="qgraphicsrectitem.html#paint">paint</a>() function draws the rectangle 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>
<p><b>Note: </b>The rendering of invalid rectangles, such as those with negative widths or heights, is undefined. If you cannot be sure that you are using valid rectangles (for example, if you are creating rectangles using data from an unreliable source) then you should use <a href="../qtcore/qrectf.html#normalized">QRectF::normalized</a>() to create normalized rectangles, and use those instead.</p></div>
<p><b>See also </b><a href="qgraphicspathitem.html">QGraphicsPathItem</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>
<!-- @@@QGraphicsRectItem -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$anonymous$$$Type -->
<h3 class="fn" id="anonymous-enum"><a name="anonymous-enum"></a>enum QGraphicsRectItem::<span class="name">anonymous</span></h3>
<p>The value returned by the virtual <a href="qgraphicsrectitem.html#type">type</a>() function.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QGraphicsRectItem::Type</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">A graphics rect item</td></tr>
</table></div>
<!-- @@@anonymous -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$ -->
<h3 class="fn fngroupitem" id="setRect-1"><a name="setRect-1"></a><span class="type">void</span> QGraphicsRectItem::<span class="name">setRect</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>width</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>height</i>)</h3>
<p>Sets the item's rectangle to the rectangle defined by (<i>x</i>, <i>y</i>) and the given <i>width</i> and <i>height</i>.</p>
<p>This convenience function is equivalent to calling <code>setRect(QRectF(x, y, width, height))</code></p>
<p><b>See also </b><a href="qgraphicsrectitem.html#rect">rect</a>().</p>
<!-- @@@ -->
<!-- $$$QGraphicsRectItem[overload1]$$$QGraphicsRectItemQGraphicsItem* -->
<h3 class="fn" id="QGraphicsRectItem"><a name="QGraphicsRectItem"></a>QGraphicsRectItem::<span class="name">QGraphicsRectItem</span>(<span class="type"><a href="qgraphicsitem.html#QGraphicsItem">QGraphicsItem</a></span> *<i>parent</i> = nullptr)</h3>
<p>Constructs a <a href="qgraphicsrectitem.html">QGraphicsRectItem</a>. <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>
<!-- @@@QGraphicsRectItem -->
<!-- $$$QGraphicsRectItem$$$QGraphicsRectItemconstQRectF&QGraphicsItem* -->
<h3 class="fn" id="QGraphicsRectItem-1"><a name="QGraphicsRectItem-1"></a>QGraphicsRectItem::<span class="name">QGraphicsRectItem</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rect</i>, <span class="type"><a href="qgraphicsitem.html#QGraphicsItem">QGraphicsItem</a></span> *<i>parent</i> = nullptr)</h3>
<p>Constructs a <a href="qgraphicsrectitem.html">QGraphicsRectItem</a>, using <i>rect</i> as the default rectangle. <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>
<!-- @@@QGraphicsRectItem -->
<!-- $$$QGraphicsRectItem$$$QGraphicsRectItemqrealqrealqrealqrealQGraphicsItem* -->
<h3 class="fn" id="QGraphicsRectItem-2"><a name="QGraphicsRectItem-2"></a>QGraphicsRectItem::<span class="name">QGraphicsRectItem</span>(<span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>x</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>y</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>width</i>, <span class="type"><a href="../qtcore/qtglobal.html#qreal-typedef">qreal</a></span> <i>height</i>, <span class="type"><a href="qgraphicsitem.html#QGraphicsItem">QGraphicsItem</a></span> *<i>parent</i> = nullptr)</h3>
<p>Constructs a <a href="qgraphicsrectitem.html">QGraphicsRectItem</a> with a default rectangle defined by (<i>x</i>, <i>y</i>) and the given <i>width</i> and <i>height</i>.</p>
<p><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>
<!-- @@@QGraphicsRectItem -->
<!-- $$$~QGraphicsRectItem[overload1]$$$~QGraphicsRectItem -->
<h3 class="fn" id="dtor.QGraphicsRectItem"><a name="dtor.QGraphicsRectItem"></a><code>[virtual] </code>QGraphicsRectItem::<span class="name">~QGraphicsRectItem</span>()</h3>
<p>Destroys the <a href="qgraphicsrectitem.html">QGraphicsRectItem</a>.</p>
<!-- @@@~QGraphicsRectItem -->
<!-- $$$boundingRect[overload1]$$$boundingRect -->
<h3 class="fn" id="boundingRect"><a name="boundingRect"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> QGraphicsRectItem::<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>[override virtual] </code><span class="type">bool</span> QGraphicsRectItem::<span class="name">contains</span>(const <span class="type"><a href="../qtcore/qpointf.html">QPointF</a></span> &amp;<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>[override virtual] </code><span class="type">bool</span> QGraphicsRectItem::<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="qabstractgraphicsshapeitem.html#isObscuredBy">QAbstractGraphicsShapeItem::isObscuredBy</a>().</p>
<!-- @@@isObscuredBy -->
<!-- $$$opaqueArea[overload1]$$$opaqueArea -->
<h3 class="fn" id="opaqueArea"><a name="opaqueArea"></a><code>[override virtual] </code><span class="type"><a href="../qtgui/qpainterpath.html">QPainterPath</a></span> QGraphicsRectItem::<span class="name">opaqueArea</span>() const</h3>
<p>Reimplemented from <a href="qabstractgraphicsshapeitem.html#opaqueArea">QAbstractGraphicsShapeItem::opaqueArea</a>().</p>
<!-- @@@opaqueArea -->
<!-- $$$paint[overload1]$$$paintQPainter*constQStyleOptionGraphicsItem*QWidget* -->
<h3 class="fn" id="paint"><a name="paint"></a><code>[override virtual] </code><span class="type">void</span> QGraphicsRectItem::<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> = nullptr)</h3>
<p>Reimplemented from <a href="qgraphicsitem.html#paint">QGraphicsItem::paint</a>().</p>
<!-- @@@paint -->
<!-- $$$rect[overload1]$$$rect -->
<h3 class="fn" id="rect"><a name="rect"></a><span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> QGraphicsRectItem::<span class="name">rect</span>() const</h3>
<p>Returns the item's rectangle.</p>
<p><b>See also </b><a href="qgraphicsrectitem.html#setRect">setRect</a>().</p>
<!-- @@@rect -->
<!-- $$$setRect[overload1]$$$setRectconstQRectF& -->
<h3 class="fn" id="setRect"><a name="setRect"></a><span class="type">void</span> QGraphicsRectItem::<span class="name">setRect</span>(const <span class="type"><a href="../qtcore/qrectf.html">QRectF</a></span> &amp;<i>rectangle</i>)</h3>
<p>Sets the item's rectangle to be the given <i>rectangle</i>.</p>
<p><b>See also </b><a href="qgraphicsrectitem.html#rect">rect</a>().</p>
<!-- @@@setRect -->
<!-- $$$shape[overload1]$$$shape -->
<h3 class="fn" id="shape"><a name="shape"></a><code>[override virtual] </code><span class="type"><a href="../qtgui/qpainterpath.html">QPainterPath</a></span> QGraphicsRectItem::<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>[override virtual] </code><span class="type">int</span> QGraphicsRectItem::<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">&copy;</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>