<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qlayoutitem.cpp --> <title>QWidgetItem 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 >QWidgetItem</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-functions">Public Functions</a></li> <li class="level1"><a href="#reimplemented-public-functions">Reimplemented 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> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QWidgetItem Class</h1> <!-- $$$QWidgetItem-brief --> <p>The <a href="qwidgetitem.html">QWidgetItem</a> class is a layout item that represents a widget. <a href="#details">More...</a></p> <!-- @@@QWidgetItem --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QWidgetItem></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"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qlayoutitem.html">QLayoutItem</a></td></tr></table></div><ul> <li><a href="qwidgetitem-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="qwidgetitem.html#QWidgetItem">QWidgetItem</a></b>(QWidget *<i>widget</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qwidgetitem.html#dtor.QWidgetItem">~QWidgetItem</a></b>()</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 QSizePolicy::ControlTypes </td><td class="memItemRight bottomAlign"><b><a href="qwidgetitem.html#controlTypes">controlTypes</a></b>() const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual Qt::Orientations </td><td class="memItemRight bottomAlign"><b><a href="qwidgetitem.html#expandingDirections">expandingDirections</a></b>() const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QRect </td><td class="memItemRight bottomAlign"><b><a href="qwidgetitem.html#geometry">geometry</a></b>() const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qwidgetitem.html#hasHeightForWidth">hasHeightForWidth</a></b>() const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qwidgetitem.html#heightForWidth">heightForWidth</a></b>(int <i>w</i>) const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qwidgetitem.html#isEmpty">isEmpty</a></b>() const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qwidgetitem.html#maximumSize">maximumSize</a></b>() const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qwidgetitem.html#minimumSize">minimumSize</a></b>() const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qwidgetitem.html#setGeometry">setGeometry</a></b>(const QRect &<i>rect</i>) override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QSize </td><td class="memItemRight bottomAlign"><b><a href="qwidgetitem.html#sizeHint">sizeHint</a></b>() const override</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qwidgetitem.html#widget">widget</a></b>() override</td></tr> </table></div> <ul> <li class="fn">17 public functions inherited from <a href="qlayoutitem.html#public-functions">QLayoutItem</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"> QWidget *</td><td class="memItemRight bottomAlign"><b><a href="qwidgetitem.html#wid-var">wid</a></b></td></tr> </table></div> <a name="details"></a> <!-- $$$QWidgetItem-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qwidgetitem.html">QWidgetItem</a> class is a layout item that represents a widget.</p> <p>Normally, you don't need to use this class directly. Qt's built-in layout managers provide the following functions for manipulating widgets in layouts:</p> <div class="table"><table class="generic"> <thead><tr class="qt-style"><th >Class</th><th >Functions</th></tr></thead> <tr valign="top" class="odd"><td ><a href="qboxlayout.html">QBoxLayout</a></td><td ><a href="qboxlayout.html#addWidget">addWidget()</a>, <a href="qboxlayout.html#insertWidget">insertWidget()</a>, <a href="qboxlayout.html#setStretchFactor">setStretchFactor()</a></td></tr> <tr valign="top" class="even"><td ><a href="qgridlayout.html">QGridLayout</a></td><td ><a href="qgridlayout.html#addWidget">addWidget()</a></td></tr> <tr valign="top" class="odd"><td ><a href="qstackedlayout.html">QStackedLayout</a></td><td ><a href="qstackedlayout.html#addWidget">addWidget()</a>, <a href="qstackedlayout.html#insertWidget">insertWidget()</a>, <a href="qstackedlayout.html#currentWidget">currentWidget()</a>, <a href="qstackedlayout.html#setCurrentWidget">setCurrentWidget()</a>, <a href="qstackedlayout.html#widget">widget()</a></td></tr> </table></div> </div> <p><b>See also </b><a href="qlayout.html">QLayout</a>, <a href="qspaceritem.html">QSpacerItem</a>, and <a href="qlayoutitem.html#widget">QLayoutItem::widget</a>().</p> <!-- @@@QWidgetItem --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QWidgetItem[overload1]$$$QWidgetItemQWidget* --> <h3 class="fn" id="QWidgetItem"><a name="QWidgetItem"></a>QWidgetItem::<span class="name">QWidgetItem</span>(<span class="type"><a href="qwidget.html">QWidget</a></span> *<i>widget</i>)</h3> <p>Creates an item containing the given <i>widget</i>.</p> <!-- @@@QWidgetItem --> <!-- $$$~QWidgetItem[overload1]$$$~QWidgetItem --> <h3 class="fn" id="dtor.QWidgetItem"><a name="dtor.QWidgetItem"></a><code>[virtual] </code>QWidgetItem::<span class="name">~QWidgetItem</span>()</h3> <p>Destructor.</p> <!-- @@@~QWidgetItem --> <!-- $$$controlTypes[overload1]$$$controlTypes --> <h3 class="fn" id="controlTypes"><a name="controlTypes"></a><code>[override virtual] </code><span class="type"><a href="qsizepolicy.html#ControlType-enum">QSizePolicy::ControlTypes</a></span> QWidgetItem::<span class="name">controlTypes</span>() const</h3> <p>Reimplemented from <a href="qlayoutitem.html#controlTypes">QLayoutItem::controlTypes</a>().</p> <p>Returns the control type associated with the widget for which this size policy applies.</p> <p><b>See also </b><a href="qsizepolicy.html#controlType">QSizePolicy::controlType</a>().</p> <!-- @@@controlTypes --> <!-- $$$expandingDirections[overload1]$$$expandingDirections --> <h3 class="fn" id="expandingDirections"><a name="expandingDirections"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qt.html#Orientation-enum">Qt::Orientations</a></span> QWidgetItem::<span class="name">expandingDirections</span>() const</h3> <p>Reimplemented from <a href="qlayoutitem.html#expandingDirections">QLayoutItem::expandingDirections</a>().</p> <!-- @@@expandingDirections --> <!-- $$$geometry[overload1]$$$geometry --> <h3 class="fn" id="geometry"><a name="geometry"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qrect.html">QRect</a></span> QWidgetItem::<span class="name">geometry</span>() const</h3> <p>Reimplemented from <a href="qlayoutitem.html#geometry">QLayoutItem::geometry</a>().</p> <p><b>See also </b><a href="qwidgetitem.html#setGeometry">setGeometry</a>().</p> <!-- @@@geometry --> <!-- $$$hasHeightForWidth[overload1]$$$hasHeightForWidth --> <h3 class="fn" id="hasHeightForWidth"><a name="hasHeightForWidth"></a><code>[override virtual] </code><span class="type">bool</span> QWidgetItem::<span class="name">hasHeightForWidth</span>() const</h3> <p>Reimplemented from <a href="qlayoutitem.html#hasHeightForWidth">QLayoutItem::hasHeightForWidth</a>().</p> <!-- @@@hasHeightForWidth --> <!-- $$$heightForWidth[overload1]$$$heightForWidthint --> <h3 class="fn" id="heightForWidth"><a name="heightForWidth"></a><code>[override virtual] </code><span class="type">int</span> QWidgetItem::<span class="name">heightForWidth</span>(<span class="type">int</span> <i>w</i>) const</h3> <p>Reimplemented from <a href="qlayoutitem.html#heightForWidth">QLayoutItem::heightForWidth</a>().</p> <!-- @@@heightForWidth --> <!-- $$$isEmpty[overload1]$$$isEmpty --> <h3 class="fn" id="isEmpty"><a name="isEmpty"></a><code>[override virtual] </code><span class="type">bool</span> QWidgetItem::<span class="name">isEmpty</span>() const</h3> <p>Reimplemented from <a href="qlayoutitem.html#isEmpty">QLayoutItem::isEmpty</a>().</p> <p>Returns <code>true</code> if the widget is hidden; otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qwidget.html#isHidden">QWidget::isHidden</a>().</p> <!-- @@@isEmpty --> <!-- $$$maximumSize[overload1]$$$maximumSize --> <h3 class="fn" id="maximumSize"><a name="maximumSize"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QWidgetItem::<span class="name">maximumSize</span>() const</h3> <p>Reimplemented from <a href="qlayoutitem.html#maximumSize">QLayoutItem::maximumSize</a>().</p> <!-- @@@maximumSize --> <!-- $$$minimumSize[overload1]$$$minimumSize --> <h3 class="fn" id="minimumSize"><a name="minimumSize"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QWidgetItem::<span class="name">minimumSize</span>() const</h3> <p>Reimplemented from <a href="qlayoutitem.html#minimumSize">QLayoutItem::minimumSize</a>().</p> <!-- @@@minimumSize --> <!-- $$$setGeometry[overload1]$$$setGeometryconstQRect& --> <h3 class="fn" id="setGeometry"><a name="setGeometry"></a><code>[override virtual] </code><span class="type">void</span> QWidgetItem::<span class="name">setGeometry</span>(const <span class="type"><a href="../qtcore/qrect.html">QRect</a></span> &<i>rect</i>)</h3> <p>Reimplemented from <a href="qlayoutitem.html#setGeometry">QLayoutItem::setGeometry</a>().</p> <p><b>See also </b><a href="qwidgetitem.html#geometry">geometry</a>().</p> <!-- @@@setGeometry --> <!-- $$$sizeHint[overload1]$$$sizeHint --> <h3 class="fn" id="sizeHint"><a name="sizeHint"></a><code>[override virtual] </code><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QWidgetItem::<span class="name">sizeHint</span>() const</h3> <p>Reimplemented from <a href="qlayoutitem.html#sizeHint">QLayoutItem::sizeHint</a>().</p> <!-- @@@sizeHint --> <!-- $$$widget[overload1]$$$widget --> <h3 class="fn" id="widget"><a name="widget"></a><code>[override virtual] </code><span class="type"><a href="qwidget.html">QWidget</a></span> *QWidgetItem::<span class="name">widget</span>()</h3> <p>Reimplemented from <a href="qlayoutitem.html#widget">QLayoutItem::widget</a>().</p> <p>Returns the widget managed by this item.</p> <!-- @@@widget --> </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>