<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qstandarditemmodel.cpp --> <title>QStandardItem 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 >QStandardItem</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-types">Public Types</a></li> <li class="level1"><a href="#public-functions">Public Functions</a></li> <li class="level1"><a href="#protected-functions">Protected Functions</a></li> <li class="level1"><a href="#protected-variables">Protected Variables</a></li> <li class="level1"><a href="#related-non-members">Related Non-Members</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> <li class="level2"><a href="#subclassing">Subclassing</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QStandardItem Class</h1> <!-- $$$QStandardItem-brief --> <p>The <a href="qstandarditem.html">QStandardItem</a> class provides an item for use with the <a href="qstandarditemmodel.html">QStandardItemModel</a> class. <a href="#details">More...</a></p> <!-- @@@QStandardItem --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QStandardItem></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"> Since:</td><td class="memItemRight bottomAlign"> Qt 4.2</td></tr></table></div><ul> <li><a href="qstandarditem-members.html">List of all members, including inherited members</a></li> <li><a href="qstandarditem-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="qstandarditem.html#ItemType-enum">ItemType</a></b> { Type, UserType }</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="qstandarditem.html#QStandardItem">QStandardItem</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#QStandardItem-1">QStandardItem</a></b>(const QString &<i>text</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#QStandardItem-2">QStandardItem</a></b>(const QIcon &<i>icon</i>, const QString &<i>text</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#QStandardItem-3">QStandardItem</a></b>(int <i>rows</i>, int <i>columns</i> = 1)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#dtor.QStandardItem">~QStandardItem</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#accessibleDescription">accessibleDescription</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#accessibleText">accessibleText</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#appendColumn">appendColumn</a></b>(const QList<QStandardItem *> &<i>items</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#appendRow">appendRow</a></b>(const QList<QStandardItem *> &<i>items</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#appendRow-1">appendRow</a></b>(QStandardItem *<i>item</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#appendRows">appendRows</a></b>(const QList<QStandardItem *> &<i>items</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QBrush </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#background">background</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> Qt::CheckState </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#checkState">checkState</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QStandardItem *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#child">child</a></b>(int <i>row</i>, int <i>column</i> = 0) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#clearData">clearData</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QStandardItem *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#clone">clone</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#column">column</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#columnCount">columnCount</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual QVariant </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#data">data</a></b>(int <i>role</i> = Qt::UserRole + 1) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> Qt::ItemFlags </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#flags">flags</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QFont </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#font">font</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QBrush </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#foreground">foreground</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#hasChildren">hasChildren</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QIcon </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#icon">icon</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QModelIndex </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#index">index</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#insertColumn">insertColumn</a></b>(int <i>column</i>, const QList<QStandardItem *> &<i>items</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#insertColumns">insertColumns</a></b>(int <i>column</i>, int <i>count</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#insertRow">insertRow</a></b>(int <i>row</i>, const QList<QStandardItem *> &<i>items</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#insertRow-1">insertRow</a></b>(int <i>row</i>, QStandardItem *<i>item</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#insertRows">insertRows</a></b>(int <i>row</i>, const QList<QStandardItem *> &<i>items</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#insertRows-1">insertRows</a></b>(int <i>row</i>, int <i>count</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#isAutoTristate">isAutoTristate</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#isCheckable">isCheckable</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#isDragEnabled">isDragEnabled</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#isDropEnabled">isDropEnabled</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#isEditable">isEditable</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#isEnabled">isEnabled</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#isSelectable">isSelectable</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#isUserTristate">isUserTristate</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QStandardItemModel *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#model">model</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QStandardItem *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#parent">parent</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#read">read</a></b>(QDataStream &<i>in</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#removeColumn">removeColumn</a></b>(int <i>column</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#removeColumns">removeColumns</a></b>(int <i>column</i>, int <i>count</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#removeRow">removeRow</a></b>(int <i>row</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#removeRows">removeRows</a></b>(int <i>row</i>, int <i>count</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#row">row</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#rowCount">rowCount</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setAccessibleDescription">setAccessibleDescription</a></b>(const QString &<i>accessibleDescription</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setAccessibleText">setAccessibleText</a></b>(const QString &<i>accessibleText</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setAutoTristate">setAutoTristate</a></b>(bool <i>tristate</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setBackground">setBackground</a></b>(const QBrush &<i>brush</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setCheckState">setCheckState</a></b>(Qt::CheckState <i>state</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setCheckable">setCheckable</a></b>(bool <i>checkable</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setChild">setChild</a></b>(int <i>row</i>, int <i>column</i>, QStandardItem *<i>item</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setChild-1">setChild</a></b>(int <i>row</i>, QStandardItem *<i>item</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setColumnCount">setColumnCount</a></b>(int <i>columns</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setData">setData</a></b>(const QVariant &<i>value</i>, int <i>role</i> = Qt::UserRole + 1)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setDragEnabled">setDragEnabled</a></b>(bool <i>dragEnabled</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setDropEnabled">setDropEnabled</a></b>(bool <i>dropEnabled</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setEditable">setEditable</a></b>(bool <i>editable</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setEnabled">setEnabled</a></b>(bool <i>enabled</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setFlags">setFlags</a></b>(Qt::ItemFlags <i>flags</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setFont">setFont</a></b>(const QFont &<i>font</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setForeground">setForeground</a></b>(const QBrush &<i>brush</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setIcon">setIcon</a></b>(const QIcon &<i>icon</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setRowCount">setRowCount</a></b>(int <i>rows</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setSelectable">setSelectable</a></b>(bool <i>selectable</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setSizeHint">setSizeHint</a></b>(const QSize &<i>size</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setStatusTip">setStatusTip</a></b>(const QString &<i>statusTip</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setText">setText</a></b>(const QString &<i>text</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setTextAlignment">setTextAlignment</a></b>(Qt::Alignment <i>alignment</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setToolTip">setToolTip</a></b>(const QString &<i>toolTip</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setUserTristate">setUserTristate</a></b>(bool <i>tristate</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#setWhatsThis">setWhatsThis</a></b>(const QString &<i>whatsThis</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QSize </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#sizeHint">sizeHint</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#sortChildren">sortChildren</a></b>(int <i>column</i>, Qt::SortOrder <i>order</i> = Qt::AscendingOrder)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#statusTip">statusTip</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QStandardItem *</td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#takeChild">takeChild</a></b>(int <i>row</i>, int <i>column</i> = 0)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QList<QStandardItem *> </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#takeColumn">takeColumn</a></b>(int <i>column</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QList<QStandardItem *> </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#takeRow">takeRow</a></b>(int <i>row</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#text">text</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> Qt::Alignment </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#textAlignment">textAlignment</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#toolTip">toolTip</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual int </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#type">type</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#whatsThis">whatsThis</a></b>() const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#write">write</a></b>(QDataStream &<i>out</i>) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#operator-lt">operator<</a></b>(const QStandardItem &<i>other</i>) const</td></tr> </table></div> <a name="protected-functions"></a> <h2 id="protected-functions">Protected Functions</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#QStandardItem-4">QStandardItem</a></b>(const QStandardItem &<i>other</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#emitDataChanged">emitDataChanged</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QStandardItem &</td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#operator-eq">operator=</a></b>(const QStandardItem &<i>other</i>)</td></tr> </table></div> <a name="protected-variables"></a> <h2 id="protected-variables">Protected Variables</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#d_ptr-var">d_ptr</a></b></td></tr> </table></div> <a name="related-non-members"></a> <h2 id="related-non-members">Related Non-Members</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> QDataStream &</td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#operator-lt-lt">operator<<</a></b>(QDataStream &<i>out</i>, const QStandardItem &<i>item</i>)</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QDataStream &</td><td class="memItemRight bottomAlign"><b><a href="qstandarditem.html#operator-gt-gt">operator>></a></b>(QDataStream &<i>in</i>, QStandardItem &<i>item</i>)</td></tr> </table></div> <a name="details"></a> <!-- $$$QStandardItem-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qstandarditem.html">QStandardItem</a> class provides an item for use with the <a href="qstandarditemmodel.html">QStandardItemModel</a> class.</p> <p>Items usually contain text, icons, or checkboxes.</p> <p>Each item can have its own background brush which is set with the <a href="qstandarditem.html#setBackground">setBackground</a>() function. The current background brush can be found with <a href="qstandarditem.html#background">background</a>(). The text label for each item can be rendered with its own font and brush. These are specified with the <a href="qstandarditem.html#setFont">setFont</a>() and <a href="qstandarditem.html#setForeground">setForeground</a>() functions, and read with <a href="qstandarditem.html#font">font</a>() and <a href="qstandarditem.html#foreground">foreground</a>().</p> <p>By default, items are enabled, editable, selectable, checkable, and can be used both as the source of a drag and drop operation and as a drop target. Each item's flags can be changed by calling <a href="qstandarditem.html#setFlags">setFlags</a>(). Checkable items can be checked and unchecked with the <a href="qstandarditem.html#setCheckState">setCheckState</a>() function. The corresponding <a href="qstandarditem.html#checkState">checkState</a>() function indicates whether the item is currently checked.</p> <p>You can store application-specific data in an item by calling <a href="qstandarditem.html#setData">setData</a>().</p> <p>Each item can have a two-dimensional table of child items. This makes it possible to build hierarchies of items. The typical hierarchy is the tree, in which case the child table is a table with a single column (a list).</p> <p>The dimensions of the child table can be set with <a href="qstandarditem.html#setRowCount">setRowCount</a>() and <a href="qstandarditem.html#setColumnCount">setColumnCount</a>(). Items can be positioned in the child table with <a href="qstandarditem.html#setChild">setChild</a>(). Get a pointer to a child item with <a href="qstandarditem.html#child">child</a>(). New rows and columns of children can also be inserted with <a href="qstandarditem.html#insertRow">insertRow</a>() and <a href="qstandarditem.html#insertColumn">insertColumn</a>(), or appended with <a href="qstandarditem.html#appendRow">appendRow</a>() and <a href="qstandarditem.html#appendColumn">appendColumn</a>(). When using the append and insert functions, the dimensions of the child table will grow as needed.</p> <p>An existing row of children can be removed with <a href="qstandarditem.html#removeRow">removeRow</a>() or <a href="qstandarditem.html#takeRow">takeRow</a>(); correspondingly, a column can be removed with <a href="qstandarditem.html#removeColumn">removeColumn</a>() or <a href="qstandarditem.html#takeColumn">takeColumn</a>().</p> <p>An item's children can be sorted by calling <a href="qstandarditem.html#sortChildren">sortChildren</a>().</p> <a name="subclassing"></a> <h3 >Subclassing</h3> <p>When subclassing <a href="qstandarditem.html">QStandardItem</a> to provide custom items, it is possible to define new types for them so that they can be distinguished from the base class. The <a href="qstandarditem.html#type">type</a>() function should be reimplemented to return a new type value equal to or greater than <a href="qstandarditem.html#ItemType-enum">UserType</a>.</p> <p>Reimplement <a href="qstandarditem.html#data">data</a>() and <a href="qstandarditem.html#setData">setData</a>() if you want to perform custom handling of data queries and/or control how an item's data is represented.</p> <p>Reimplement <a href="qstandarditem.html#clone">clone</a>() if you want <a href="qstandarditemmodel.html">QStandardItemModel</a> to be able to create instances of your custom item class on demand (see <a href="qstandarditemmodel.html#setItemPrototype">QStandardItemModel::setItemPrototype</a>()).</p> <p>Reimplement <a href="qstandarditem.html#read">read</a>() and <a href="qstandarditem.html#write">write</a>() if you want to control how items are represented in their serialized form.</p> <p>Reimplement <a href="qstandarditem.html#operator-lt">operator<</a>() if you want to control the semantics of item comparison. <a href="qstandarditem.html#operator-lt">operator<</a>() determines the sorted order when sorting items with <a href="qstandarditem.html#sortChildren">sortChildren</a>() or with <a href="qstandarditemmodel.html#sort">QStandardItemModel::sort</a>().</p> </div> <p><b>See also </b><a href="qstandarditemmodel.html">QStandardItemModel</a>, <a href="../qtwidgets/model-view-programming.html#item-view-convenience-classes">Item View Convenience Classes</a>, and <a href="../qtwidgets/model-view-programming.html">Model/View Programming</a>.</p> <!-- @@@QStandardItem --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$ItemType$$$Type$$$UserType --> <h3 class="fn" id="ItemType-enum"><a name="ItemType-enum"></a>enum QStandardItem::<span class="name">ItemType</span></h3> <p>This enum describes the types that are used to describe standard items.</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>QStandardItem::Type</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">The default type for standard items.</td></tr> <tr><td class="topAlign"><code>QStandardItem::UserType</code></td><td class="topAlign tblval"><code>1000</code></td><td class="topAlign">The minimum value for custom types. Values below UserType are reserved by Qt.</td></tr> </table></div> <p>You can define new user types in <a href="qstandarditem.html">QStandardItem</a> subclasses to ensure that custom items are treated specially; for example, when items are sorted.</p> <p><b>See also </b><a href="qstandarditem.html#type">type</a>().</p> <!-- @@@ItemType --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QStandardItem[overload1]$$$QStandardItem --> <h3 class="fn" id="QStandardItem"><a name="QStandardItem"></a>QStandardItem::<span class="name">QStandardItem</span>()</h3> <p>Constructs an item.</p> <!-- @@@QStandardItem --> <!-- $$$QStandardItem$$$QStandardItemconstQString& --> <h3 class="fn" id="QStandardItem-1"><a name="QStandardItem-1"></a>QStandardItem::<span class="name">QStandardItem</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>text</i>)</h3> <p>Constructs an item with the given <i>text</i>.</p> <!-- @@@QStandardItem --> <!-- $$$QStandardItem$$$QStandardItemconstQIcon&constQString& --> <h3 class="fn" id="QStandardItem-2"><a name="QStandardItem-2"></a>QStandardItem::<span class="name">QStandardItem</span>(const <span class="type"><a href="qicon.html">QIcon</a></span> &<i>icon</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>text</i>)</h3> <p>Constructs an item with the given <i>icon</i> and <i>text</i>.</p> <!-- @@@QStandardItem --> <!-- $$$QStandardItem$$$QStandardItemintint --> <h3 class="fn" id="QStandardItem-3"><a name="QStandardItem-3"></a>QStandardItem::<span class="name">QStandardItem</span>(<span class="type">int</span> <i>rows</i>, <span class="type">int</span> <i>columns</i> = 1)</h3> <p>Constructs an item with <i>rows</i> rows and <i>columns</i> columns of child items.</p> <!-- @@@QStandardItem --> <!-- $$$QStandardItem$$$QStandardItemconstQStandardItem& --> <h3 class="fn" id="QStandardItem-4"><a name="QStandardItem-4"></a><code>[protected] </code>QStandardItem::<span class="name">QStandardItem</span>(const <span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> &<i>other</i>)</h3> <p>Constructs a copy of <i>other</i>. Note that <a href="qstandarditem.html#model">model</a>() is not copied.</p> <p>This function is useful when reimplementing <a href="qstandarditem.html#clone">clone</a>().</p> <!-- @@@QStandardItem --> <!-- $$$~QStandardItem[overload1]$$$~QStandardItem --> <h3 class="fn" id="dtor.QStandardItem"><a name="dtor.QStandardItem"></a><code>[virtual] </code>QStandardItem::<span class="name">~QStandardItem</span>()</h3> <p>Destructs the item. This causes the item's children to be destructed as well.</p> <!-- @@@~QStandardItem --> <!-- $$$accessibleDescription[overload1]$$$accessibleDescription --> <h3 class="fn" id="accessibleDescription"><a name="accessibleDescription"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QStandardItem::<span class="name">accessibleDescription</span>() const</h3> <p>Returns the item's accessible description.</p> <p>The accessible description is used by assistive technologies (i.e. for users who cannot use conventional means of interaction).</p> <p><b>See also </b><a href="qstandarditem.html#setAccessibleDescription">setAccessibleDescription</a>() and <a href="qstandarditem.html#accessibleText">accessibleText</a>().</p> <!-- @@@accessibleDescription --> <!-- $$$accessibleText[overload1]$$$accessibleText --> <h3 class="fn" id="accessibleText"><a name="accessibleText"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QStandardItem::<span class="name">accessibleText</span>() const</h3> <p>Returns the item's accessible text.</p> <p>The accessible text is used by assistive technologies (i.e. for users who cannot use conventional means of interaction).</p> <p><b>See also </b><a href="qstandarditem.html#setAccessibleText">setAccessibleText</a>() and <a href="qstandarditem.html#accessibleDescription">accessibleDescription</a>().</p> <!-- @@@accessibleText --> <!-- $$$appendColumn[overload1]$$$appendColumnconstQList<QStandardItem*>& --> <h3 class="fn" id="appendColumn"><a name="appendColumn"></a><span class="type">void</span> QStandardItem::<span class="name">appendColumn</span>(const <span class="type">QList</span><<span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *> &<i>items</i>)</h3> <p>Appends a column containing <i>items</i>. If necessary, the row count is increased to the size of <i>items</i>.</p> <p><b>See also </b><a href="qstandarditem.html#insertColumn">insertColumn</a>().</p> <!-- @@@appendColumn --> <!-- $$$appendRow[overload1]$$$appendRowconstQList<QStandardItem*>& --> <h3 class="fn" id="appendRow"><a name="appendRow"></a><span class="type">void</span> QStandardItem::<span class="name">appendRow</span>(const <span class="type">QList</span><<span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *> &<i>items</i>)</h3> <p>Appends a row containing <i>items</i>. If necessary, the column count is increased to the size of <i>items</i>.</p> <p><b>See also </b><a href="qstandarditem.html#insertRow">insertRow</a>().</p> <!-- @@@appendRow --> <!-- $$$appendRow$$$appendRowQStandardItem* --> <h3 class="fn" id="appendRow-1"><a name="appendRow-1"></a><span class="type">void</span> QStandardItem::<span class="name">appendRow</span>(<span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *<i>item</i>)</h3> <p>This is an overloaded function.</p> <p>Appends a row containing <i>item</i>.</p> <p>When building a list or a tree that has only one column, this function provides a convenient way to append a single new item.</p> <!-- @@@appendRow --> <!-- $$$appendRows[overload1]$$$appendRowsconstQList<QStandardItem*>& --> <h3 class="fn" id="appendRows"><a name="appendRows"></a><span class="type">void</span> QStandardItem::<span class="name">appendRows</span>(const <span class="type">QList</span><<span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *> &<i>items</i>)</h3> <p>Appends rows containing <i>items</i>. The column count will not change.</p> <p><b>See also </b><a href="qstandarditem.html#insertRow">insertRow</a>().</p> <!-- @@@appendRows --> <!-- $$$background[overload1]$$$background --> <h3 class="fn" id="background"><a name="background"></a><span class="type"><a href="qbrush.html">QBrush</a></span> QStandardItem::<span class="name">background</span>() const</h3> <p>Returns the brush used to render the item's background.</p> <p><b>See also </b><a href="qstandarditem.html#foreground">foreground</a>() and <a href="qstandarditem.html#setBackground">setBackground</a>().</p> <!-- @@@background --> <!-- $$$checkState[overload1]$$$checkState --> <h3 class="fn" id="checkState"><a name="checkState"></a><span class="type"><a href="../qtcore/qt.html#CheckState-enum">Qt::CheckState</a></span> QStandardItem::<span class="name">checkState</span>() const</h3> <p>Returns the checked state of the item.</p> <p><b>See also </b><a href="qstandarditem.html#setCheckState">setCheckState</a>() and <a href="qstandarditem.html#isCheckable">isCheckable</a>().</p> <!-- @@@checkState --> <!-- $$$child[overload1]$$$childintint --> <h3 class="fn" id="child"><a name="child"></a><span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *QStandardItem::<span class="name">child</span>(<span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>column</i> = 0) const</h3> <p>Returns the child item at (<i>row</i>, <i>column</i>) if one has been set; otherwise returns <code>nullptr</code>.</p> <p><b>See also </b><a href="qstandarditem.html#setChild">setChild</a>(), <a href="qstandarditem.html#takeChild">takeChild</a>(), and <a href="qstandarditem.html#parent">parent</a>().</p> <!-- @@@child --> <!-- $$$clearData[overload1]$$$clearData --> <h3 class="fn" id="clearData"><a name="clearData"></a><span class="type">void</span> QStandardItem::<span class="name">clearData</span>()</h3> <p>Removes all the data from all roles previously set.</p> <p>This function was introduced in Qt 5.12.</p> <p><b>See also </b><a href="qstandarditem.html#data">data</a>() and <a href="qstandarditem.html#setData">setData</a>().</p> <!-- @@@clearData --> <!-- $$$clone[overload1]$$$clone --> <h3 class="fn" id="clone"><a name="clone"></a><code>[virtual] </code><span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *QStandardItem::<span class="name">clone</span>() const</h3> <p>Returns a copy of this item. The item's children are not copied.</p> <p>When subclassing <a href="qstandarditem.html">QStandardItem</a>, you can reimplement this function to provide <a href="qstandarditemmodel.html">QStandardItemModel</a> with a factory that it can use to create new items on demand.</p> <p><b>See also </b><a href="qstandarditemmodel.html#setItemPrototype">QStandardItemModel::setItemPrototype</a>() and <a href="qstandarditem.html#operator-eq">operator=</a>().</p> <!-- @@@clone --> <!-- $$$column[overload1]$$$column --> <h3 class="fn" id="column"><a name="column"></a><span class="type">int</span> QStandardItem::<span class="name">column</span>() const</h3> <p>Returns the column where the item is located in its parent's child table, or -1 if the item has no parent.</p> <p><b>See also </b><a href="qstandarditem.html#row">row</a>() and <a href="qstandarditem.html#parent">parent</a>().</p> <!-- @@@column --> <!-- $$$columnCount[overload1]$$$columnCount --> <h3 class="fn" id="columnCount"><a name="columnCount"></a><span class="type">int</span> QStandardItem::<span class="name">columnCount</span>() const</h3> <p>Returns the number of child item columns that the item has.</p> <p><b>See also </b><a href="qstandarditem.html#setColumnCount">setColumnCount</a>() and <a href="qstandarditem.html#rowCount">rowCount</a>().</p> <!-- @@@columnCount --> <!-- $$$data[overload1]$$$dataint --> <h3 class="fn" id="data"><a name="data"></a><code>[virtual] </code><span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> QStandardItem::<span class="name">data</span>(<span class="type">int</span> <i>role</i> = Qt::UserRole + 1) const</h3> <p>Returns the item's data for the given <i>role</i>, or an invalid <a href="../qtcore/qvariant.html">QVariant</a> if there is no data for the role.</p> <p><b>Note: </b>The default implementation treats <a href="../qtcore/qt.html#ItemDataRole-enum">Qt::EditRole</a> and <a href="../qtcore/qt.html#ItemDataRole-enum">Qt::DisplayRole</a> as referring to the same data.</p><p><b>See also </b><a href="qstandarditem.html#setData">setData</a>().</p> <!-- @@@data --> <!-- $$$emitDataChanged[overload1]$$$emitDataChanged --> <h3 class="fn" id="emitDataChanged"><a name="emitDataChanged"></a><code>[protected] </code><span class="type">void</span> QStandardItem::<span class="name">emitDataChanged</span>()</h3> <p>Causes the model associated with this item to emit a <a href="../qtcore/qabstractitemmodel.html#dataChanged">dataChanged</a>() signal for this item.</p> <p>You normally only need to call this function if you have subclassed <a href="qstandarditem.html">QStandardItem</a> and reimplemented <a href="qstandarditem.html#data">data</a>() and/or <a href="qstandarditem.html#setData">setData</a>().</p> <p>This function was introduced in Qt 4.4.</p> <p><b>See also </b><a href="qstandarditem.html#setData">setData</a>().</p> <!-- @@@emitDataChanged --> <!-- $$$flags[overload1]$$$flags --> <h3 class="fn" id="flags"><a name="flags"></a><span class="type"><a href="../qtcore/qt.html#ItemFlag-enum">Qt::ItemFlags</a></span> QStandardItem::<span class="name">flags</span>() const</h3> <p>Returns the item flags for the item.</p> <p>The item flags determine how the user can interact with the item.</p> <p>By default, items are enabled, editable, selectable, checkable, and can be used both as the source of a drag and drop operation and as a drop target.</p> <p><b>See also </b><a href="qstandarditem.html#setFlags">setFlags</a>().</p> <!-- @@@flags --> <!-- $$$font[overload1]$$$font --> <h3 class="fn" id="font"><a name="font"></a><span class="type"><a href="qfont.html">QFont</a></span> QStandardItem::<span class="name">font</span>() const</h3> <p>Returns the font used to render the item's text.</p> <p><b>See also </b><a href="qstandarditem.html#setFont">setFont</a>().</p> <!-- @@@font --> <!-- $$$foreground[overload1]$$$foreground --> <h3 class="fn" id="foreground"><a name="foreground"></a><span class="type"><a href="qbrush.html">QBrush</a></span> QStandardItem::<span class="name">foreground</span>() const</h3> <p>Returns the brush used to render the item's foreground (e.g. text).</p> <p><b>See also </b><a href="qstandarditem.html#setForeground">setForeground</a>() and <a href="qstandarditem.html#background">background</a>().</p> <!-- @@@foreground --> <!-- $$$hasChildren[overload1]$$$hasChildren --> <h3 class="fn" id="hasChildren"><a name="hasChildren"></a><span class="type">bool</span> QStandardItem::<span class="name">hasChildren</span>() const</h3> <p>Returns <code>true</code> if this item has any children; otherwise returns <code>false</code>.</p> <p><b>See also </b><a href="qstandarditem.html#rowCount">rowCount</a>(), <a href="qstandarditem.html#columnCount">columnCount</a>(), and <a href="qstandarditem.html#child">child</a>().</p> <!-- @@@hasChildren --> <!-- $$$icon[overload1]$$$icon --> <h3 class="fn" id="icon"><a name="icon"></a><span class="type"><a href="qicon.html">QIcon</a></span> QStandardItem::<span class="name">icon</span>() const</h3> <p>Returns the item's icon.</p> <p><b>See also </b><a href="qstandarditem.html#setIcon">setIcon</a>() and <a href="../qtwidgets/qabstractitemview.html#iconSize-prop">iconSize</a>.</p> <!-- @@@icon --> <!-- $$$index[overload1]$$$index --> <h3 class="fn" id="index"><a name="index"></a><span class="type"><a href="../qtcore/qmodelindex.html">QModelIndex</a></span> QStandardItem::<span class="name">index</span>() const</h3> <p>Returns the <a href="../qtcore/qmodelindex.html">QModelIndex</a> associated with this item.</p> <p>When you need to invoke item functionality in a <a href="../qtcore/qmodelindex.html">QModelIndex</a>-based API (e.g. <a href="../qtwidgets/qabstractitemview.html">QAbstractItemView</a>), you can call this function to obtain an index that corresponds to the item's location in the model.</p> <p>If the item is not associated with a model, an invalid <a href="../qtcore/qmodelindex.html">QModelIndex</a> is returned.</p> <p><b>See also </b><a href="qstandarditem.html#model">model</a>() and <a href="qstandarditemmodel.html#itemFromIndex">QStandardItemModel::itemFromIndex</a>().</p> <!-- @@@index --> <!-- $$$insertColumn[overload1]$$$insertColumnintconstQList<QStandardItem*>& --> <h3 class="fn" id="insertColumn"><a name="insertColumn"></a><span class="type">void</span> QStandardItem::<span class="name">insertColumn</span>(<span class="type">int</span> <i>column</i>, const <span class="type">QList</span><<span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *> &<i>items</i>)</h3> <p>Inserts a column at <i>column</i> containing <i>items</i>. If necessary, the row count is increased to the size of <i>items</i>.</p> <p><b>See also </b><a href="qstandarditem.html#insertColumns">insertColumns</a>() and <a href="qstandarditem.html#insertRow">insertRow</a>().</p> <!-- @@@insertColumn --> <!-- $$$insertColumns[overload1]$$$insertColumnsintint --> <h3 class="fn" id="insertColumns"><a name="insertColumns"></a><span class="type">void</span> QStandardItem::<span class="name">insertColumns</span>(<span class="type">int</span> <i>column</i>, <span class="type">int</span> <i>count</i>)</h3> <p>Inserts <i>count</i> columns of child items at column <i>column</i>.</p> <p><b>See also </b><a href="qstandarditem.html#insertColumn">insertColumn</a>() and <a href="qstandarditem.html#insertRows">insertRows</a>().</p> <!-- @@@insertColumns --> <!-- $$$insertRow[overload1]$$$insertRowintconstQList<QStandardItem*>& --> <h3 class="fn" id="insertRow"><a name="insertRow"></a><span class="type">void</span> QStandardItem::<span class="name">insertRow</span>(<span class="type">int</span> <i>row</i>, const <span class="type">QList</span><<span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *> &<i>items</i>)</h3> <p>Inserts a row at <i>row</i> containing <i>items</i>. If necessary, the column count is increased to the size of <i>items</i>.</p> <p><b>See also </b><a href="qstandarditem.html#insertRows">insertRows</a>() and <a href="qstandarditem.html#insertColumn">insertColumn</a>().</p> <!-- @@@insertRow --> <!-- $$$insertRow$$$insertRowintQStandardItem* --> <h3 class="fn" id="insertRow-1"><a name="insertRow-1"></a><span class="type">void</span> QStandardItem::<span class="name">insertRow</span>(<span class="type">int</span> <i>row</i>, <span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *<i>item</i>)</h3> <p>This is an overloaded function.</p> <p>Inserts a row at <i>row</i> containing <i>item</i>.</p> <p>When building a list or a tree that has only one column, this function provides a convenient way to insert a single new item.</p> <!-- @@@insertRow --> <!-- $$$insertRows[overload1]$$$insertRowsintconstQList<QStandardItem*>& --> <h3 class="fn" id="insertRows"><a name="insertRows"></a><span class="type">void</span> QStandardItem::<span class="name">insertRows</span>(<span class="type">int</span> <i>row</i>, const <span class="type">QList</span><<span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *> &<i>items</i>)</h3> <p>Inserts <i>items</i> at <i>row</i>. The column count won't be changed.</p> <p><b>See also </b><a href="qstandarditem.html#insertRow">insertRow</a>() and <a href="qstandarditem.html#insertColumn">insertColumn</a>().</p> <!-- @@@insertRows --> <!-- $$$insertRows$$$insertRowsintint --> <h3 class="fn" id="insertRows-1"><a name="insertRows-1"></a><span class="type">void</span> QStandardItem::<span class="name">insertRows</span>(<span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>count</i>)</h3> <p>Inserts <i>count</i> rows of child items at row <i>row</i>.</p> <p><b>See also </b><a href="qstandarditem.html#insertRow">insertRow</a>() and <a href="qstandarditem.html#insertColumns">insertColumns</a>().</p> <!-- @@@insertRows --> <!-- $$$isAutoTristate[overload1]$$$isAutoTristate --> <h3 class="fn" id="isAutoTristate"><a name="isAutoTristate"></a><span class="type">bool</span> QStandardItem::<span class="name">isAutoTristate</span>() const</h3> <p>Returns whether the item is tristate and is controlled by <a href="../qtwidgets/qtreewidget.html">QTreeWidget</a>.</p> <p>The default value is false.</p> <p>This function was introduced in Qt 5.6.</p> <p><b>See also </b><a href="qstandarditem.html#setAutoTristate">setAutoTristate</a>(), <a href="qstandarditem.html#isCheckable">isCheckable</a>(), and <a href="qstandarditem.html#checkState">checkState</a>().</p> <!-- @@@isAutoTristate --> <!-- $$$isCheckable[overload1]$$$isCheckable --> <h3 class="fn" id="isCheckable"><a name="isCheckable"></a><span class="type">bool</span> QStandardItem::<span class="name">isCheckable</span>() const</h3> <p>Returns whether the item is user-checkable.</p> <p>The default value is false.</p> <p><b>See also </b><a href="qstandarditem.html#setCheckable">setCheckable</a>(), <a href="qstandarditem.html#checkState">checkState</a>(), <a href="qstandarditem.html#isUserTristate">isUserTristate</a>(), and <a href="qstandarditem.html#isAutoTristate">isAutoTristate</a>().</p> <!-- @@@isCheckable --> <!-- $$$isDragEnabled[overload1]$$$isDragEnabled --> <h3 class="fn" id="isDragEnabled"><a name="isDragEnabled"></a><span class="type">bool</span> QStandardItem::<span class="name">isDragEnabled</span>() const</h3> <p>Returns whether the item is drag enabled. An item that is drag enabled can be dragged by the user.</p> <p>The default value is true.</p> <p>Note that item dragging must be enabled in the view for dragging to work; see <a href="../qtwidgets/qabstractitemview.html#dragEnabled-prop">QAbstractItemView::dragEnabled</a>.</p> <p><b>See also </b><a href="qstandarditem.html#setDragEnabled">setDragEnabled</a>(), <a href="qstandarditem.html#isDropEnabled">isDropEnabled</a>(), and <a href="qstandarditem.html#flags">flags</a>().</p> <!-- @@@isDragEnabled --> <!-- $$$isDropEnabled[overload1]$$$isDropEnabled --> <h3 class="fn" id="isDropEnabled"><a name="isDropEnabled"></a><span class="type">bool</span> QStandardItem::<span class="name">isDropEnabled</span>() const</h3> <p>Returns whether the item is drop enabled. When an item is drop enabled, it can be used as a drop target.</p> <p>The default value is true.</p> <p><b>See also </b><a href="qstandarditem.html#setDropEnabled">setDropEnabled</a>(), <a href="qstandarditem.html#isDragEnabled">isDragEnabled</a>(), and <a href="qstandarditem.html#flags">flags</a>().</p> <!-- @@@isDropEnabled --> <!-- $$$isEditable[overload1]$$$isEditable --> <h3 class="fn" id="isEditable"><a name="isEditable"></a><span class="type">bool</span> QStandardItem::<span class="name">isEditable</span>() const</h3> <p>Returns whether the item can be edited by the user.</p> <p>When an item is editable (and enabled), the user can edit the item by invoking one of the view's edit triggers; see <a href="../qtwidgets/qabstractitemview.html#editTriggers-prop">QAbstractItemView::editTriggers</a>.</p> <p>The default value is true.</p> <p><b>See also </b><a href="qstandarditem.html#setEditable">setEditable</a>() and <a href="qstandarditem.html#flags">flags</a>().</p> <!-- @@@isEditable --> <!-- $$$isEnabled[overload1]$$$isEnabled --> <h3 class="fn" id="isEnabled"><a name="isEnabled"></a><span class="type">bool</span> QStandardItem::<span class="name">isEnabled</span>() const</h3> <p>Returns whether the item is enabled.</p> <p>When an item is enabled, the user can interact with it. The possible types of interaction are specified by the other item flags, such as <a href="qstandarditem.html#isEditable">isEditable</a>() and <a href="qstandarditem.html#isSelectable">isSelectable</a>().</p> <p>The default value is true.</p> <p><b>See also </b><a href="qstandarditem.html#setEnabled">setEnabled</a>() and <a href="qstandarditem.html#flags">flags</a>().</p> <!-- @@@isEnabled --> <!-- $$$isSelectable[overload1]$$$isSelectable --> <h3 class="fn" id="isSelectable"><a name="isSelectable"></a><span class="type">bool</span> QStandardItem::<span class="name">isSelectable</span>() const</h3> <p>Returns whether the item is selectable by the user.</p> <p>The default value is true.</p> <p><b>See also </b><a href="qstandarditem.html#setSelectable">setSelectable</a>() and <a href="qstandarditem.html#flags">flags</a>().</p> <!-- @@@isSelectable --> <!-- $$$isUserTristate[overload1]$$$isUserTristate --> <h3 class="fn" id="isUserTristate"><a name="isUserTristate"></a><span class="type">bool</span> QStandardItem::<span class="name">isUserTristate</span>() const</h3> <p>Returns whether the item is tristate; that is, if it's checkable with three separate states and the user can cycle through all three states.</p> <p>The default value is false.</p> <p>This function was introduced in Qt 5.6.</p> <p><b>See also </b><a href="qstandarditem.html#setUserTristate">setUserTristate</a>(), <a href="qstandarditem.html#isCheckable">isCheckable</a>(), and <a href="qstandarditem.html#checkState">checkState</a>().</p> <!-- @@@isUserTristate --> <!-- $$$model[overload1]$$$model --> <h3 class="fn" id="model"><a name="model"></a><span class="type"><a href="qstandarditemmodel.html">QStandardItemModel</a></span> *QStandardItem::<span class="name">model</span>() const</h3> <p>Returns the <a href="qstandarditemmodel.html">QStandardItemModel</a> that this item belongs to.</p> <p>If the item is not a child of another item that belongs to the model, this function returns <code>nullptr</code>.</p> <p><b>See also </b><a href="qstandarditem.html#index">index</a>().</p> <!-- @@@model --> <!-- $$$parent[overload1]$$$parent --> <h3 class="fn" id="parent"><a name="parent"></a><span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *QStandardItem::<span class="name">parent</span>() const</h3> <p>Returns the item's parent item, or <code>nullptr</code> if the item has no parent.</p> <p><b>Note: </b>For toplevel items parent() returns <code>nullptr</code>. To receive toplevel item's parent use <a href="qstandarditemmodel.html#invisibleRootItem">QStandardItemModel::invisibleRootItem</a>() instead.</p><p><b>See also </b><a href="qstandarditem.html#child">child</a>() and <a href="qstandarditemmodel.html#invisibleRootItem">QStandardItemModel::invisibleRootItem</a>().</p> <!-- @@@parent --> <!-- $$$read[overload1]$$$readQDataStream& --> <h3 class="fn" id="read"><a name="read"></a><code>[virtual] </code><span class="type">void</span> QStandardItem::<span class="name">read</span>(<span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &<i>in</i>)</h3> <p>Reads the item from stream <i>in</i>. Only the data and flags of the item are read, not the child items.</p> <p><b>See also </b><a href="qstandarditem.html#write">write</a>().</p> <!-- @@@read --> <!-- $$$removeColumn[overload1]$$$removeColumnint --> <h3 class="fn" id="removeColumn"><a name="removeColumn"></a><span class="type">void</span> QStandardItem::<span class="name">removeColumn</span>(<span class="type">int</span> <i>column</i>)</h3> <p>Removes the given <i>column</i>. The items that were in the column are deleted.</p> <p><b>See also </b><a href="qstandarditem.html#takeColumn">takeColumn</a>(), <a href="qstandarditem.html#removeColumns">removeColumns</a>(), and <a href="qstandarditem.html#removeRow">removeRow</a>().</p> <!-- @@@removeColumn --> <!-- $$$removeColumns[overload1]$$$removeColumnsintint --> <h3 class="fn" id="removeColumns"><a name="removeColumns"></a><span class="type">void</span> QStandardItem::<span class="name">removeColumns</span>(<span class="type">int</span> <i>column</i>, <span class="type">int</span> <i>count</i>)</h3> <p>Removes <i>count</i> columns at column <i>column</i>. The items that were in those columns are deleted.</p> <p><b>See also </b><a href="qstandarditem.html#removeColumn">removeColumn</a>() and <a href="qstandarditem.html#removeRows">removeRows</a>().</p> <!-- @@@removeColumns --> <!-- $$$removeRow[overload1]$$$removeRowint --> <h3 class="fn" id="removeRow"><a name="removeRow"></a><span class="type">void</span> QStandardItem::<span class="name">removeRow</span>(<span class="type">int</span> <i>row</i>)</h3> <p>Removes the given <i>row</i>. The items that were in the row are deleted.</p> <p><b>See also </b><a href="qstandarditem.html#takeRow">takeRow</a>(), <a href="qstandarditem.html#removeRows">removeRows</a>(), and <a href="qstandarditem.html#removeColumn">removeColumn</a>().</p> <!-- @@@removeRow --> <!-- $$$removeRows[overload1]$$$removeRowsintint --> <h3 class="fn" id="removeRows"><a name="removeRows"></a><span class="type">void</span> QStandardItem::<span class="name">removeRows</span>(<span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>count</i>)</h3> <p>Removes <i>count</i> rows at row <i>row</i>. The items that were in those rows are deleted.</p> <p><b>See also </b><a href="qstandarditem.html#removeRow">removeRow</a>() and <a href="qstandarditem.html#removeColumn">removeColumn</a>().</p> <!-- @@@removeRows --> <!-- $$$row[overload1]$$$row --> <h3 class="fn" id="row"><a name="row"></a><span class="type">int</span> QStandardItem::<span class="name">row</span>() const</h3> <p>Returns the row where the item is located in its parent's child table, or -1 if the item has no parent.</p> <p><b>See also </b><a href="qstandarditem.html#column">column</a>() and <a href="qstandarditem.html#parent">parent</a>().</p> <!-- @@@row --> <!-- $$$rowCount[overload1]$$$rowCount --> <h3 class="fn" id="rowCount"><a name="rowCount"></a><span class="type">int</span> QStandardItem::<span class="name">rowCount</span>() const</h3> <p>Returns the number of child item rows that the item has.</p> <p><b>See also </b><a href="qstandarditem.html#setRowCount">setRowCount</a>() and <a href="qstandarditem.html#columnCount">columnCount</a>().</p> <!-- @@@rowCount --> <!-- $$$setAccessibleDescription[overload1]$$$setAccessibleDescriptionconstQString& --> <h3 class="fn" id="setAccessibleDescription"><a name="setAccessibleDescription"></a><span class="type">void</span> QStandardItem::<span class="name">setAccessibleDescription</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>accessibleDescription</i>)</h3> <p>Sets the item's accessible description to the string specified by <i>accessibleDescription</i>.</p> <p>The accessible description is used by assistive technologies (i.e. for users who cannot use conventional means of interaction).</p> <p><b>See also </b><a href="qstandarditem.html#accessibleDescription">accessibleDescription</a>() and <a href="qstandarditem.html#setAccessibleText">setAccessibleText</a>().</p> <!-- @@@setAccessibleDescription --> <!-- $$$setAccessibleText[overload1]$$$setAccessibleTextconstQString& --> <h3 class="fn" id="setAccessibleText"><a name="setAccessibleText"></a><span class="type">void</span> QStandardItem::<span class="name">setAccessibleText</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>accessibleText</i>)</h3> <p>Sets the item's accessible text to the string specified by <i>accessibleText</i>.</p> <p>The accessible text is used by assistive technologies (i.e. for users who cannot use conventional means of interaction).</p> <p><b>See also </b><a href="qstandarditem.html#accessibleText">accessibleText</a>() and <a href="qstandarditem.html#setAccessibleDescription">setAccessibleDescription</a>().</p> <!-- @@@setAccessibleText --> <!-- $$$setAutoTristate[overload1]$$$setAutoTristatebool --> <h3 class="fn" id="setAutoTristate"><a name="setAutoTristate"></a><span class="type">void</span> QStandardItem::<span class="name">setAutoTristate</span>(<span class="type">bool</span> <i>tristate</i>)</h3> <p>Determines that the item is tristate and controlled by <a href="../qtwidgets/qtreewidget.html">QTreeWidget</a> if <i>tristate</i> is <code>true</code>. This enables automatic management of the state of parent items in <a href="../qtwidgets/qtreewidget.html">QTreeWidget</a> (checked if all children are checked, unchecked if all children are unchecked, or partially checked if only some children are checked).</p> <p>This function was introduced in Qt 5.6.</p> <p><b>See also </b><a href="qstandarditem.html#isAutoTristate">isAutoTristate</a>(), <a href="qstandarditem.html#setCheckable">setCheckable</a>(), and <a href="qstandarditem.html#setCheckState">setCheckState</a>().</p> <!-- @@@setAutoTristate --> <!-- $$$setBackground[overload1]$$$setBackgroundconstQBrush& --> <h3 class="fn" id="setBackground"><a name="setBackground"></a><span class="type">void</span> QStandardItem::<span class="name">setBackground</span>(const <span class="type"><a href="qbrush.html">QBrush</a></span> &<i>brush</i>)</h3> <p>Sets the item's background brush to the specified <i>brush</i>.</p> <p><b>See also </b><a href="qstandarditem.html#background">background</a>() and <a href="qstandarditem.html#setForeground">setForeground</a>().</p> <!-- @@@setBackground --> <!-- $$$setCheckState[overload1]$$$setCheckStateQt::CheckState --> <h3 class="fn" id="setCheckState"><a name="setCheckState"></a><span class="type">void</span> QStandardItem::<span class="name">setCheckState</span>(<span class="type"><a href="../qtcore/qt.html#CheckState-enum">Qt::CheckState</a></span> <i>state</i>)</h3> <p>Sets the check state of the item to be <i>state</i>.</p> <p><b>See also </b><a href="qstandarditem.html#checkState">checkState</a>() and <a href="qstandarditem.html#setCheckable">setCheckable</a>().</p> <!-- @@@setCheckState --> <!-- $$$setCheckable[overload1]$$$setCheckablebool --> <h3 class="fn" id="setCheckable"><a name="setCheckable"></a><span class="type">void</span> QStandardItem::<span class="name">setCheckable</span>(<span class="type">bool</span> <i>checkable</i>)</h3> <p>Sets whether the item is user-checkable. If <i>checkable</i> is true, the item can be checked by the user; otherwise, the user cannot check the item.</p> <p>The item delegate will render a checkable item with a check box next to the item's text.</p> <p><b>See also </b><a href="qstandarditem.html#isCheckable">isCheckable</a>(), <a href="qstandarditem.html#setCheckState">setCheckState</a>(), <a href="qstandarditem.html#setUserTristate">setUserTristate</a>(), and <a href="qstandarditem.html#setAutoTristate">setAutoTristate</a>().</p> <!-- @@@setCheckable --> <!-- $$$setChild[overload1]$$$setChildintintQStandardItem* --> <h3 class="fn" id="setChild"><a name="setChild"></a><span class="type">void</span> QStandardItem::<span class="name">setChild</span>(<span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>column</i>, <span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *<i>item</i>)</h3> <p>Sets the child item at (<i>row</i>, <i>column</i>) to <i>item</i>. This item (the parent item) takes ownership of <i>item</i>. If necessary, the row count and column count are increased to fit the item.</p> <p><b>Note: </b>Passing a null pointer as <i>item</i> removes the item.</p><p><b>See also </b><a href="qstandarditem.html#child">child</a>().</p> <!-- @@@setChild --> <!-- $$$setChild$$$setChildintQStandardItem* --> <h3 class="fn" id="setChild-1"><a name="setChild-1"></a><span class="type">void</span> QStandardItem::<span class="name">setChild</span>(<span class="type">int</span> <i>row</i>, <span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *<i>item</i>)</h3> <p>This is an overloaded function.</p> <p>Sets the child at <i>row</i> to <i>item</i>.</p> <!-- @@@setChild --> <!-- $$$setColumnCount[overload1]$$$setColumnCountint --> <h3 class="fn" id="setColumnCount"><a name="setColumnCount"></a><span class="type">void</span> QStandardItem::<span class="name">setColumnCount</span>(<span class="type">int</span> <i>columns</i>)</h3> <p>Sets the number of child item columns to <i>columns</i>. If this is less than <a href="qstandarditem.html#columnCount">columnCount</a>(), the data in the unwanted columns is discarded.</p> <p><b>See also </b><a href="qstandarditem.html#columnCount">columnCount</a>() and <a href="qstandarditem.html#setRowCount">setRowCount</a>().</p> <!-- @@@setColumnCount --> <!-- $$$setData[overload1]$$$setDataconstQVariant&int --> <h3 class="fn" id="setData"><a name="setData"></a><code>[virtual] </code><span class="type">void</span> QStandardItem::<span class="name">setData</span>(const <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> &<i>value</i>, <span class="type">int</span> <i>role</i> = Qt::UserRole + 1)</h3> <p>Sets the item's data for the given <i>role</i> to the specified <i>value</i>.</p> <p>If you subclass <a href="qstandarditem.html">QStandardItem</a> and reimplement this function, your reimplementation should call <a href="qstandarditem.html#emitDataChanged">emitDataChanged</a>() if you do not call the base implementation of setData(). This will ensure that e.g. views using the model are notified of the changes.</p> <p><b>Note: </b>The default implementation treats <a href="../qtcore/qt.html#ItemDataRole-enum">Qt::EditRole</a> and <a href="../qtcore/qt.html#ItemDataRole-enum">Qt::DisplayRole</a> as referring to the same data.</p><p><b>See also </b><a href="../qtcore/qt.html#ItemDataRole-enum">Qt::ItemDataRole</a>, <a href="qstandarditem.html#data">data</a>(), and <a href="qstandarditem.html#setFlags">setFlags</a>().</p> <!-- @@@setData --> <!-- $$$setDragEnabled[overload1]$$$setDragEnabledbool --> <h3 class="fn" id="setDragEnabled"><a name="setDragEnabled"></a><span class="type">void</span> QStandardItem::<span class="name">setDragEnabled</span>(<span class="type">bool</span> <i>dragEnabled</i>)</h3> <p>Sets whether the item is drag enabled. If <i>dragEnabled</i> is true, the item can be dragged by the user; otherwise, the user cannot drag the item.</p> <p>Note that you also need to ensure that item dragging is enabled in the view; see <a href="../qtwidgets/qabstractitemview.html#dragEnabled-prop">QAbstractItemView::dragEnabled</a>.</p> <p><b>See also </b><a href="qstandarditem.html#isDragEnabled">isDragEnabled</a>(), <a href="qstandarditem.html#setDropEnabled">setDropEnabled</a>(), and <a href="qstandarditem.html#setFlags">setFlags</a>().</p> <!-- @@@setDragEnabled --> <!-- $$$setDropEnabled[overload1]$$$setDropEnabledbool --> <h3 class="fn" id="setDropEnabled"><a name="setDropEnabled"></a><span class="type">void</span> QStandardItem::<span class="name">setDropEnabled</span>(<span class="type">bool</span> <i>dropEnabled</i>)</h3> <p>Sets whether the item is drop enabled. If <i>dropEnabled</i> is true, the item can be used as a drop target; otherwise, it cannot.</p> <p>Note that you also need to ensure that drops are enabled in the view; see <a href="../qtwidgets/qwidget.html#acceptDrops-prop">QWidget::acceptDrops</a>(); and that the model supports the desired drop actions; see <a href="../qtcore/qabstractitemmodel.html#supportedDropActions">QAbstractItemModel::supportedDropActions</a>().</p> <p><b>See also </b><a href="qstandarditem.html#isDropEnabled">isDropEnabled</a>(), <a href="qstandarditem.html#setDragEnabled">setDragEnabled</a>(), and <a href="qstandarditem.html#setFlags">setFlags</a>().</p> <!-- @@@setDropEnabled --> <!-- $$$setEditable[overload1]$$$setEditablebool --> <h3 class="fn" id="setEditable"><a name="setEditable"></a><span class="type">void</span> QStandardItem::<span class="name">setEditable</span>(<span class="type">bool</span> <i>editable</i>)</h3> <p>Sets whether the item is editable. If <i>editable</i> is true, the item can be edited by the user; otherwise, the user cannot edit the item.</p> <p>How the user can edit items in a view is determined by the view's edit triggers; see <a href="../qtwidgets/qabstractitemview.html#editTriggers-prop">QAbstractItemView::editTriggers</a>.</p> <p><b>See also </b><a href="qstandarditem.html#isEditable">isEditable</a>() and <a href="qstandarditem.html#setFlags">setFlags</a>().</p> <!-- @@@setEditable --> <!-- $$$setEnabled[overload1]$$$setEnabledbool --> <h3 class="fn" id="setEnabled"><a name="setEnabled"></a><span class="type">void</span> QStandardItem::<span class="name">setEnabled</span>(<span class="type">bool</span> <i>enabled</i>)</h3> <p>Sets whether the item is enabled. If <i>enabled</i> is true, the item is enabled, meaning that the user can interact with the item; if <i>enabled</i> is false, the user cannot interact with the item.</p> <p>This flag takes precedence over the other item flags; e.g. if an item is not enabled, it cannot be selected by the user, even if the <a href="../qtcore/qt.html#ItemFlag-enum">Qt::ItemIsSelectable</a> flag has been set.</p> <p><b>See also </b><a href="qstandarditem.html#isEnabled">isEnabled</a>(), <a href="../qtcore/qt.html#ItemFlag-enum">Qt::ItemIsEnabled</a>, and <a href="qstandarditem.html#setFlags">setFlags</a>().</p> <!-- @@@setEnabled --> <!-- $$$setFlags[overload1]$$$setFlagsQt::ItemFlags --> <h3 class="fn" id="setFlags"><a name="setFlags"></a><span class="type">void</span> QStandardItem::<span class="name">setFlags</span>(<span class="type"><a href="../qtcore/qt.html#ItemFlag-enum">Qt::ItemFlags</a></span> <i>flags</i>)</h3> <p>Sets the item flags for the item to <i>flags</i>.</p> <p>The item flags determine how the user can interact with the item. This is often used to disable an item.</p> <p><b>See also </b><a href="qstandarditem.html#flags">flags</a>() and <a href="qstandarditem.html#setData">setData</a>().</p> <!-- @@@setFlags --> <!-- $$$setFont[overload1]$$$setFontconstQFont& --> <h3 class="fn" id="setFont"><a name="setFont"></a><span class="type">void</span> QStandardItem::<span class="name">setFont</span>(const <span class="type"><a href="qfont.html">QFont</a></span> &<i>font</i>)</h3> <p>Sets the font used to display the item's text to the given <i>font</i>.</p> <p><b>See also </b><a href="qstandarditem.html#font">font</a>(), <a href="qstandarditem.html#setText">setText</a>(), and <a href="qstandarditem.html#setForeground">setForeground</a>().</p> <!-- @@@setFont --> <!-- $$$setForeground[overload1]$$$setForegroundconstQBrush& --> <h3 class="fn" id="setForeground"><a name="setForeground"></a><span class="type">void</span> QStandardItem::<span class="name">setForeground</span>(const <span class="type"><a href="qbrush.html">QBrush</a></span> &<i>brush</i>)</h3> <p>Sets the brush used to display the item's foreground (e.g. text) to the given <i>brush</i>.</p> <p><b>See also </b><a href="qstandarditem.html#foreground">foreground</a>(), <a href="qstandarditem.html#setBackground">setBackground</a>(), and <a href="qstandarditem.html#setFont">setFont</a>().</p> <!-- @@@setForeground --> <!-- $$$setIcon[overload1]$$$setIconconstQIcon& --> <h3 class="fn" id="setIcon"><a name="setIcon"></a><span class="type">void</span> QStandardItem::<span class="name">setIcon</span>(const <span class="type"><a href="qicon.html">QIcon</a></span> &<i>icon</i>)</h3> <p>Sets the item's icon to the <i>icon</i> specified.</p> <p><b>See also </b><a href="qstandarditem.html#icon">icon</a>().</p> <!-- @@@setIcon --> <!-- $$$setRowCount[overload1]$$$setRowCountint --> <h3 class="fn" id="setRowCount"><a name="setRowCount"></a><span class="type">void</span> QStandardItem::<span class="name">setRowCount</span>(<span class="type">int</span> <i>rows</i>)</h3> <p>Sets the number of child item rows to <i>rows</i>. If this is less than <a href="qstandarditem.html#rowCount">rowCount</a>(), the data in the unwanted rows is discarded.</p> <p><b>See also </b><a href="qstandarditem.html#rowCount">rowCount</a>() and <a href="qstandarditem.html#setColumnCount">setColumnCount</a>().</p> <!-- @@@setRowCount --> <!-- $$$setSelectable[overload1]$$$setSelectablebool --> <h3 class="fn" id="setSelectable"><a name="setSelectable"></a><span class="type">void</span> QStandardItem::<span class="name">setSelectable</span>(<span class="type">bool</span> <i>selectable</i>)</h3> <p>Sets whether the item is selectable. If <i>selectable</i> is true, the item can be selected by the user; otherwise, the user cannot select the item.</p> <p>You can control the selection behavior and mode by manipulating their view properties; see <a href="../qtwidgets/qabstractitemview.html#selectionMode-prop">QAbstractItemView::selectionMode</a> and <a href="../qtwidgets/qabstractitemview.html#selectionBehavior-prop">QAbstractItemView::selectionBehavior</a>.</p> <p><b>See also </b><a href="qstandarditem.html#isSelectable">isSelectable</a>() and <a href="qstandarditem.html#setFlags">setFlags</a>().</p> <!-- @@@setSelectable --> <!-- $$$setSizeHint[overload1]$$$setSizeHintconstQSize& --> <h3 class="fn" id="setSizeHint"><a name="setSizeHint"></a><span class="type">void</span> QStandardItem::<span class="name">setSizeHint</span>(const <span class="type"><a href="../qtcore/qsize.html">QSize</a></span> &<i>size</i>)</h3> <p>Sets the size hint for the item to be <i>size</i>. If no size hint is set, the item delegate will compute the size hint based on the item data.</p> <p><b>See also </b><a href="qstandarditem.html#sizeHint">sizeHint</a>().</p> <!-- @@@setSizeHint --> <!-- $$$setStatusTip[overload1]$$$setStatusTipconstQString& --> <h3 class="fn" id="setStatusTip"><a name="setStatusTip"></a><span class="type">void</span> QStandardItem::<span class="name">setStatusTip</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>statusTip</i>)</h3> <p>Sets the item's status tip to the string specified by <i>statusTip</i>.</p> <p><b>See also </b><a href="qstandarditem.html#statusTip">statusTip</a>(), <a href="qstandarditem.html#setToolTip">setToolTip</a>(), and <a href="qstandarditem.html#setWhatsThis">setWhatsThis</a>().</p> <!-- @@@setStatusTip --> <!-- $$$setText[overload1]$$$setTextconstQString& --> <h3 class="fn" id="setText"><a name="setText"></a><span class="type">void</span> QStandardItem::<span class="name">setText</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>text</i>)</h3> <p>Sets the item's text to the <i>text</i> specified.</p> <p><b>See also </b><a href="qstandarditem.html#text">text</a>(), <a href="qstandarditem.html#setFont">setFont</a>(), and <a href="qstandarditem.html#setForeground">setForeground</a>().</p> <!-- @@@setText --> <!-- $$$setTextAlignment[overload1]$$$setTextAlignmentQt::Alignment --> <h3 class="fn" id="setTextAlignment"><a name="setTextAlignment"></a><span class="type">void</span> QStandardItem::<span class="name">setTextAlignment</span>(<span class="type"><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::Alignment</a></span> <i>alignment</i>)</h3> <p>Sets the text alignment for the item's text to the <i>alignment</i> specified.</p> <p><b>See also </b><a href="qstandarditem.html#textAlignment">textAlignment</a>().</p> <!-- @@@setTextAlignment --> <!-- $$$setToolTip[overload1]$$$setToolTipconstQString& --> <h3 class="fn" id="setToolTip"><a name="setToolTip"></a><span class="type">void</span> QStandardItem::<span class="name">setToolTip</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>toolTip</i>)</h3> <p>Sets the item's tooltip to the string specified by <i>toolTip</i>.</p> <p><b>See also </b><a href="qstandarditem.html#toolTip">toolTip</a>(), <a href="qstandarditem.html#setStatusTip">setStatusTip</a>(), and <a href="qstandarditem.html#setWhatsThis">setWhatsThis</a>().</p> <!-- @@@setToolTip --> <!-- $$$setUserTristate[overload1]$$$setUserTristatebool --> <h3 class="fn" id="setUserTristate"><a name="setUserTristate"></a><span class="type">void</span> QStandardItem::<span class="name">setUserTristate</span>(<span class="type">bool</span> <i>tristate</i>)</h3> <p>Sets whether the item is tristate and controlled by the user. If <i>tristate</i> is true, the user can cycle through three separate states; otherwise, the item is checkable with two states. (Note that this also requires that the item is checkable; see <a href="qstandarditem.html#isCheckable">isCheckable</a>().)</p> <p>This function was introduced in Qt 5.6.</p> <p><b>See also </b><a href="qstandarditem.html#isUserTristate">isUserTristate</a>(), <a href="qstandarditem.html#setCheckable">setCheckable</a>(), and <a href="qstandarditem.html#setCheckState">setCheckState</a>().</p> <!-- @@@setUserTristate --> <!-- $$$setWhatsThis[overload1]$$$setWhatsThisconstQString& --> <h3 class="fn" id="setWhatsThis"><a name="setWhatsThis"></a><span class="type">void</span> QStandardItem::<span class="name">setWhatsThis</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &<i>whatsThis</i>)</h3> <p>Sets the item's "What's This?" help to the string specified by <i>whatsThis</i>.</p> <p><b>See also </b><a href="qstandarditem.html#whatsThis">whatsThis</a>(), <a href="qstandarditem.html#setStatusTip">setStatusTip</a>(), and <a href="qstandarditem.html#setToolTip">setToolTip</a>().</p> <!-- @@@setWhatsThis --> <!-- $$$sizeHint[overload1]$$$sizeHint --> <h3 class="fn" id="sizeHint"><a name="sizeHint"></a><span class="type"><a href="../qtcore/qsize.html">QSize</a></span> QStandardItem::<span class="name">sizeHint</span>() const</h3> <p>Returns the size hint set for the item, or an invalid <a href="../qtcore/qsize.html">QSize</a> if no size hint has been set.</p> <p>If no size hint has been set, the item delegate will compute the size hint based on the item data.</p> <p><b>See also </b><a href="qstandarditem.html#setSizeHint">setSizeHint</a>().</p> <!-- @@@sizeHint --> <!-- $$$sortChildren[overload1]$$$sortChildrenintQt::SortOrder --> <h3 class="fn" id="sortChildren"><a name="sortChildren"></a><span class="type">void</span> QStandardItem::<span class="name">sortChildren</span>(<span class="type">int</span> <i>column</i>, <span class="type"><a href="../qtcore/qt.html#SortOrder-enum">Qt::SortOrder</a></span> <i>order</i> = Qt::AscendingOrder)</h3> <p>Sorts the children of the item using the given <i>order</i>, by the values in the given <i>column</i>.</p> <p><b>Note: </b>This function is recursive, therefore it sorts the children of the item, its grandchildren, etc.</p><p><b>See also </b><a href="qstandarditem.html#operator-lt">operator<</a>().</p> <!-- @@@sortChildren --> <!-- $$$statusTip[overload1]$$$statusTip --> <h3 class="fn" id="statusTip"><a name="statusTip"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QStandardItem::<span class="name">statusTip</span>() const</h3> <p>Returns the item's status tip.</p> <p><b>See also </b><a href="qstandarditem.html#setStatusTip">setStatusTip</a>(), <a href="qstandarditem.html#toolTip">toolTip</a>(), and <a href="qstandarditem.html#whatsThis">whatsThis</a>().</p> <!-- @@@statusTip --> <!-- $$$takeChild[overload1]$$$takeChildintint --> <h3 class="fn" id="takeChild"><a name="takeChild"></a><span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *QStandardItem::<span class="name">takeChild</span>(<span class="type">int</span> <i>row</i>, <span class="type">int</span> <i>column</i> = 0)</h3> <p>Removes the child item at (<i>row</i>, <i>column</i>) without deleting it, and returns a pointer to the item. If there was no child at the given location, then this function returns <code>nullptr</code>.</p> <p>Note that this function, unlike <a href="qstandarditem.html#takeRow">takeRow</a>() and <a href="qstandarditem.html#takeColumn">takeColumn</a>(), does not affect the dimensions of the child table.</p> <p><b>See also </b><a href="qstandarditem.html#child">child</a>(), <a href="qstandarditem.html#takeRow">takeRow</a>(), and <a href="qstandarditem.html#takeColumn">takeColumn</a>().</p> <!-- @@@takeChild --> <!-- $$$takeColumn[overload1]$$$takeColumnint --> <h3 class="fn" id="takeColumn"><a name="takeColumn"></a><span class="type">QList</span><<span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *> QStandardItem::<span class="name">takeColumn</span>(<span class="type">int</span> <i>column</i>)</h3> <p>Removes <i>column</i> without deleting the column items, and returns a list of pointers to the removed items. For items in the column that have not been set, the corresponding pointers in the list will be 0.</p> <p><b>See also </b><a href="qstandarditem.html#removeColumn">removeColumn</a>(), <a href="qstandarditem.html#insertColumn">insertColumn</a>(), and <a href="qstandarditem.html#takeRow">takeRow</a>().</p> <!-- @@@takeColumn --> <!-- $$$takeRow[overload1]$$$takeRowint --> <h3 class="fn" id="takeRow"><a name="takeRow"></a><span class="type">QList</span><<span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> *> QStandardItem::<span class="name">takeRow</span>(<span class="type">int</span> <i>row</i>)</h3> <p>Removes <i>row</i> without deleting the row items, and returns a list of pointers to the removed items. For items in the row that have not been set, the corresponding pointers in the list will be 0.</p> <p><b>See also </b><a href="qstandarditem.html#removeRow">removeRow</a>(), <a href="qstandarditem.html#insertRow">insertRow</a>(), and <a href="qstandarditem.html#takeColumn">takeColumn</a>().</p> <!-- @@@takeRow --> <!-- $$$text[overload1]$$$text --> <h3 class="fn" id="text"><a name="text"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QStandardItem::<span class="name">text</span>() const</h3> <p>Returns the item's text. This is the text that's presented to the user in a view.</p> <p><b>See also </b><a href="qstandarditem.html#setText">setText</a>().</p> <!-- @@@text --> <!-- $$$textAlignment[overload1]$$$textAlignment --> <h3 class="fn" id="textAlignment"><a name="textAlignment"></a><span class="type"><a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::Alignment</a></span> QStandardItem::<span class="name">textAlignment</span>() const</h3> <p>Returns the text alignment for the item's text.</p> <p><b>See also </b><a href="qstandarditem.html#setTextAlignment">setTextAlignment</a>().</p> <!-- @@@textAlignment --> <!-- $$$toolTip[overload1]$$$toolTip --> <h3 class="fn" id="toolTip"><a name="toolTip"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QStandardItem::<span class="name">toolTip</span>() const</h3> <p>Returns the item's tooltip.</p> <p><b>See also </b><a href="qstandarditem.html#setToolTip">setToolTip</a>(), <a href="qstandarditem.html#statusTip">statusTip</a>(), and <a href="qstandarditem.html#whatsThis">whatsThis</a>().</p> <!-- @@@toolTip --> <!-- $$$type[overload1]$$$type --> <h3 class="fn" id="type"><a name="type"></a><code>[virtual] </code><span class="type">int</span> QStandardItem::<span class="name">type</span>() const</h3> <p>Returns the type of this item. The type is used to distinguish custom items from the base class. When subclassing <a href="qstandarditem.html">QStandardItem</a>, you should reimplement this function and return a new value greater than or equal to <a href="qstandarditem.html#ItemType-enum">UserType</a>.</p> <p><b>See also </b><a href="qstandarditem.html#ItemType-enum">QStandardItem::Type</a>.</p> <!-- @@@type --> <!-- $$$whatsThis[overload1]$$$whatsThis --> <h3 class="fn" id="whatsThis"><a name="whatsThis"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QStandardItem::<span class="name">whatsThis</span>() const</h3> <p>Returns the item's "What's This?" help.</p> <p><b>See also </b><a href="qstandarditem.html#setWhatsThis">setWhatsThis</a>(), <a href="qstandarditem.html#toolTip">toolTip</a>(), and <a href="qstandarditem.html#statusTip">statusTip</a>().</p> <!-- @@@whatsThis --> <!-- $$$write[overload1]$$$writeQDataStream& --> <h3 class="fn" id="write"><a name="write"></a><code>[virtual] </code><span class="type">void</span> QStandardItem::<span class="name">write</span>(<span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &<i>out</i>) const</h3> <p>Writes the item to stream <i>out</i>. Only the data and flags of the item are written, not the child items.</p> <p><b>See also </b><a href="qstandarditem.html#read">read</a>().</p> <!-- @@@write --> <!-- $$$operator<[overload1]$$$operator<constQStandardItem& --> <h3 class="fn" id="operator-lt"><a name="operator-lt"></a><code>[virtual] </code><span class="type">bool</span> QStandardItem::<span class="name">operator<</span>(const <span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> &<i>other</i>) const</h3> <p>Returns <code>true</code> if this item is less than <i>other</i>; otherwise returns <code>false</code>.</p> <p>The default implementation uses the data for the item's sort role (see <a href="qstandarditemmodel.html#sortRole-prop">QStandardItemModel::sortRole</a>) to perform the comparison if the item belongs to a model; otherwise, the data for the item's <a href="../qtcore/qt.html#ItemDataRole-enum">Qt::DisplayRole</a> (<a href="qstandarditem.html#text">text</a>()) is used to perform the comparison.</p> <p><a href="qstandarditem.html#sortChildren">sortChildren</a>() and <a href="qstandarditemmodel.html#sort">QStandardItemModel::sort</a>() use this function when sorting items. If you want custom sorting, you can subclass <a href="qstandarditem.html">QStandardItem</a> and reimplement this function.</p> <!-- @@@operator< --> <!-- $$$operator=[overload1]$$$operator=constQStandardItem& --> <h3 class="fn" id="operator-eq"><a name="operator-eq"></a><code>[protected] </code><span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> &QStandardItem::<span class="name">operator=</span>(const <span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> &<i>other</i>)</h3> <p>Assigns <i>other</i>'s data and flags to this item. Note that <a href="qstandarditem.html#type">type</a>() and <a href="qstandarditem.html#model">model</a>() are not copied.</p> <p>This function is useful when reimplementing <a href="qstandarditem.html#clone">clone</a>().</p> <!-- @@@operator= --> </div> <div class="relnonmem"> <h2>Related Non-Members</h2> <!-- $$$operator<<[overload1]$$$operator<<QDataStream&constQStandardItem& --> <h3 class="fn" id="operator-lt-lt"><a name="operator-lt-lt"></a><span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &<span class="name">operator<<</span>(<span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &<i>out</i>, const <span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> &<i>item</i>)</h3> <p>Writes the <a href="qstandarditem.html">QStandardItem</a> <i>item</i> to stream <i>out</i>.</p> <p>This operator uses <a href="qstandarditem.html#write">QStandardItem::write</a>().</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also </b><a href="../qtcore/datastreamformat.html">Serializing Qt Data Types</a>.</p> <!-- @@@operator<< --> <!-- $$$operator>>[overload1]$$$operator>>QDataStream&QStandardItem& --> <h3 class="fn" id="operator-gt-gt"><a name="operator-gt-gt"></a><span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &<span class="name">operator>></span>(<span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &<i>in</i>, <span class="type"><a href="qstandarditem.html#QStandardItem">QStandardItem</a></span> &<i>item</i>)</h3> <p>Reads a <a href="qstandarditem.html">QStandardItem</a> from stream <i>in</i> into <i>item</i>.</p> <p>This operator uses <a href="qstandarditem.html#read">QStandardItem::read</a>().</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also </b><a href="../qtcore/datastreamformat.html">Serializing Qt Data Types</a>.</p> <!-- @@@operator>> --> </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>