Sophie

Sophie

distrib > Mageia > 6 > armv5tl > media > core-updates > by-pkgid > 768f7d9f703884aa2562bf0a651086df > files > 3427

qtbase5-doc-5.9.4-1.1.mga6.noarch.rpm

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qlistwidget.cpp -->
  <title>QListWidgetItem Class | Qt Widgets 5.9</title>
  <link rel="stylesheet" type="text/css" href="style/offline-simple.css" />
  <script type="text/javascript">
    document.getElementsByTagName("link").item(0).setAttribute("href", "style/offline.css");
    // loading style sheet breaks anchors that were jumped to before
    // so force jumping to anchor again
    setTimeout(function() {
        var anchor = location.hash;
        // need to jump to different anchor first (e.g. none)
        location.hash = "#";
        setTimeout(function() {
            location.hash = anchor;
        }, 0);
    }, 0);
  </script>
</head>
<body>
<div class="header" id="qtdocheader">
  <div class="main">
    <div class="main-rounded">
      <div class="navigationbar">
        <table><tr>
<td >Qt 5.9</td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QListWidgetItem</td></tr></table><table class="buildversion"><tr>
<td id="buildversion" width="100%" align="right">Qt 5.9.4 Reference Documentation</td>
        </tr></table>
      </div>
    </div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</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">QListWidgetItem Class</h1>
<!-- $$$QListWidgetItem-brief -->
<p>The <a href="qlistwidgetitem.html">QListWidgetItem</a> class provides an item for use with the <a href="qlistwidget.html">QListWidget</a> item view class. <a href="#details">More...</a></p>
<!-- @@@QListWidgetItem -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign">   <span class="preprocessor">#include &lt;QListWidgetItem&gt;</span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr></table></div><ul>
<li><a href="qlistwidgetitem-members.html">List of all members, including inherited members</a></li>
<li><a href="qlistwidgetitem-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="qlistwidgetitem.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="qlistwidgetitem.html#QListWidgetItem">QListWidgetItem</a></b>(QListWidget *<i>parent</i> = Q_NULLPTR, int <i>type</i> = Type)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#QListWidgetItem-1">QListWidgetItem</a></b>(const QString &amp;<i>text</i>, QListWidget *<i>parent</i> = Q_NULLPTR, int <i>type</i> = Type)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#QListWidgetItem-2">QListWidgetItem</a></b>(const QIcon &amp;<i>icon</i>, const QString &amp;<i>text</i>, QListWidget *<i>parent</i> = Q_NULLPTR, int <i>type</i> = Type)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#QListWidgetItem-3">QListWidgetItem</a></b>(const QListWidgetItem &amp;<i>other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#dtor.QListWidgetItem">~QListWidgetItem</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBrush </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#background">background</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::CheckState </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#checkState">checkState</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QListWidgetItem *</td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#clone">clone</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QVariant </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#data">data</a></b>(int <i>role</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> Qt::ItemFlags </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#flags">flags</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QFont </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#font">font</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QBrush </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#foreground">foreground</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QIcon </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#icon">icon</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#isHidden">isHidden</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#isSelected">isSelected</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QListWidget *</td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#listWidget">listWidget</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#read">read</a></b>(QDataStream &amp;<i>in</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#setBackground">setBackground</a></b>(const QBrush &amp;<i>brush</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#setCheckState">setCheckState</a></b>(Qt::CheckState <i>state</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#setData">setData</a></b>(int <i>role</i>, const QVariant &amp;<i>value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.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="qlistwidgetitem.html#setFont">setFont</a></b>(const QFont &amp;<i>font</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#setForeground">setForeground</a></b>(const QBrush &amp;<i>brush</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#setHidden">setHidden</a></b>(bool <i>hide</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#setIcon">setIcon</a></b>(const QIcon &amp;<i>icon</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#setSelected">setSelected</a></b>(bool <i>select</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#setSizeHint">setSizeHint</a></b>(const QSize &amp;<i>size</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#setStatusTip">setStatusTip</a></b>(const QString &amp;<i>statusTip</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#setText">setText</a></b>(const QString &amp;<i>text</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#setTextAlignment">setTextAlignment</a></b>(int <i>alignment</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#setToolTip">setToolTip</a></b>(const QString &amp;<i>toolTip</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#setWhatsThis">setWhatsThis</a></b>(const QString &amp;<i>whatsThis</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QSize </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#sizeHint">sizeHint</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#statusTip">statusTip</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#text">text</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#textAlignment">textAlignment</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#toolTip">toolTip</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#type">type</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#whatsThis">whatsThis</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#write">write</a></b>(QDataStream &amp;<i>out</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#operator-lt">operator&lt;</a></b>(const QListWidgetItem &amp;<i>other</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QListWidgetItem &amp;</td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#operator-eq">operator=</a></b>(const QListWidgetItem &amp;<i>other</i>)</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 &amp;</td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#operator-lt-lt">operator&lt;&lt;</a></b>(QDataStream &amp;<i>out</i>, const QListWidgetItem &amp;<i>item</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDataStream &amp;</td><td class="memItemRight bottomAlign"><b><a href="qlistwidgetitem.html#operator-gt-gt">operator&gt;&gt;</a></b>(QDataStream &amp;<i>in</i>, QListWidgetItem &amp;<i>item</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QListWidgetItem-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qlistwidgetitem.html">QListWidgetItem</a> class provides an item for use with the <a href="qlistwidget.html">QListWidget</a> item view class.</p>
<p>A <a href="qlistwidgetitem.html">QListWidgetItem</a> represents a single item in a <a href="qlistwidget.html">QListWidget</a>. Each item can hold several pieces of information, and will display them appropriately.</p>
<p>The item view convenience classes use a classic item-based interface rather than a pure model/view approach. For a more flexible list view widget, consider using the <a href="qlistview.html">QListView</a> class with a standard model.</p>
<p>List items can be inserted automatically into a list, when they are constructed, by specifying the list widget:</p>
<pre class="cpp">

      <span class="keyword">new</span> <span class="type"><a href="qlistwidgetitem.html#QListWidgetItem">QListWidgetItem</a></span>(tr(<span class="string">&quot;Hazel&quot;</span>)<span class="operator">,</span> listWidget);

</pre>
<p>Alternatively, list items can also be created without a parent widget, and later inserted into a list using <a href="qlistwidget.html#insertItem">QListWidget::insertItem</a>().</p>
<p>List items are typically used to display <a href="qlistwidgetitem.html#text">text</a>() and an <a href="qlistwidgetitem.html#icon">icon</a>(). These are set with the <a href="qlistwidgetitem.html#setText">setText</a>() and <a href="qlistwidgetitem.html#setIcon">setIcon</a>() functions. The appearance of the text can be customized with <a href="qlistwidgetitem.html#setFont">setFont</a>(), <a href="qlistwidgetitem.html#setForeground">setForeground</a>(), and <a href="qlistwidgetitem.html#setBackground">setBackground</a>(). Text in list items can be aligned using the <a href="qlistwidgetitem.html#setTextAlignment">setTextAlignment</a>() function. Tooltips, status tips and &quot;What's This?&quot; help can be added to list items with <a href="qlistwidgetitem.html#setToolTip">setToolTip</a>(), <a href="qlistwidgetitem.html#setStatusTip">setStatusTip</a>(), and <a href="qlistwidgetitem.html#setWhatsThis">setWhatsThis</a>().</p>
<p>By default, items are enabled, selectable, checkable, and can be the source of drag and drop operations.</p>
<p>Each item's flags can be changed by calling <a href="qlistwidgetitem.html#setFlags">setFlags</a>() with the appropriate value (see <a href="../qtcore/qt.html#ItemFlag-enum">Qt::ItemFlags</a>). Checkable items can be checked, unchecked and partially checked with the <a href="qlistwidgetitem.html#setCheckState">setCheckState</a>() function. The corresponding <a href="qlistwidgetitem.html#checkState">checkState</a>() function indicates the item's current check state.</p>
<p>The <a href="qlistwidgetitem.html#isHidden">isHidden</a>() function can be used to determine whether the item is hidden. To hide an item, use <a href="qlistwidgetitem.html#setHidden">setHidden</a>().</p>
<a name="subclassing"></a>
<h3 >Subclassing</h3>
<p>When subclassing <a href="qlistwidgetitem.html">QListWidgetItem</a> to provide custom items, it is possible to define new types for them enabling them to be distinguished from standard items. For subclasses that require this feature, ensure that you call the base class constructor with a new type value equal to or greater than <a href="qlistwidgetitem.html#ItemType-enum">UserType</a>, within <i>your</i> constructor.</p>
</div>
<p><b>See also </b><a href="qlistwidget.html">QListWidget</a>, <a href="model-view-programming.html">Model/View Programming</a>, <a href="qtreewidgetitem.html">QTreeWidgetItem</a>, and <a href="qtablewidgetitem.html">QTableWidgetItem</a>.</p>
<!-- @@@QListWidgetItem -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$ItemType$$$Type$$$UserType -->
<h3 class="fn" id="ItemType-enum"><a name="ItemType-enum"></a>enum QListWidgetItem::<span class="name">ItemType</span></h3>
<p>This enum describes the types that are used to describe list widget 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>QListWidgetItem::Type</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">The default type for list widget items.</td></tr>
<tr><td class="topAlign"><code>QListWidgetItem::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="qlistwidgetitem.html">QListWidgetItem</a> subclasses to ensure that custom items are treated specially.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#type">type</a>().</p>
<!-- @@@ItemType -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QListWidgetItem[overload1]$$$QListWidgetItemQListWidget*int -->
<h3 class="fn" id="QListWidgetItem"><a name="QListWidgetItem"></a>QListWidgetItem::<span class="name">QListWidgetItem</span>(<span class="type"><a href="qlistwidget.html">QListWidget</a></span> *<i>parent</i> = Q_NULLPTR, <span class="type">int</span> <i>type</i> = Type)</h3>
<p>Constructs an empty list widget item of the specified <i>type</i> with the given <i>parent</i>. If <i>parent</i> is not specified, the item will need to be inserted into a list widget with <a href="qlistwidget.html#insertItem">QListWidget::insertItem</a>().</p>
<p>This constructor inserts the item into the model of the parent that is passed to the constructor. If the model is sorted then the behavior of the insert is undetermined since the model will call the <code>'&lt;'</code> operator method on the item which, at this point, is not yet constructed. To avoid the undetermined behavior, we recommend not to specify the parent and use <a href="qlistwidget.html#insertItem">QListWidget::insertItem</a>() instead.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#type">type</a>().</p>
<!-- @@@QListWidgetItem -->
<!-- $$$QListWidgetItem$$$QListWidgetItemconstQString&QListWidget*int -->
<h3 class="fn" id="QListWidgetItem-1"><a name="QListWidgetItem-1"></a>QListWidgetItem::<span class="name">QListWidgetItem</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, <span class="type"><a href="qlistwidget.html">QListWidget</a></span> *<i>parent</i> = Q_NULLPTR, <span class="type">int</span> <i>type</i> = Type)</h3>
<p>Constructs an empty list widget item of the specified <i>type</i> with the given <i>text</i> and <i>parent</i>. If the parent is not specified, the item will need to be inserted into a list widget with <a href="qlistwidget.html#insertItem">QListWidget::insertItem</a>().</p>
<p>This constructor inserts the item into the model of the parent that is passed to the constructor. If the model is sorted then the behavior of the insert is undetermined since the model will call the <code>'&lt;'</code> operator method on the item which, at this point, is not yet constructed. To avoid the undetermined behavior, we recommend not to specify the parent and use <a href="qlistwidget.html#insertItem">QListWidget::insertItem</a>() instead.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#type">type</a>().</p>
<!-- @@@QListWidgetItem -->
<!-- $$$QListWidgetItem$$$QListWidgetItemconstQIcon&constQString&QListWidget*int -->
<h3 class="fn" id="QListWidgetItem-2"><a name="QListWidgetItem-2"></a>QListWidgetItem::<span class="name">QListWidgetItem</span>(const <span class="type"><a href="../qtgui/qicon.html">QIcon</a></span> &amp;<i>icon</i>, const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>, <span class="type"><a href="qlistwidget.html">QListWidget</a></span> *<i>parent</i> = Q_NULLPTR, <span class="type">int</span> <i>type</i> = Type)</h3>
<p>Constructs an empty list widget item of the specified <i>type</i> with the given <i>icon</i>, <i>text</i> and <i>parent</i>. If the parent is not specified, the item will need to be inserted into a list widget with <a href="qlistwidget.html#insertItem">QListWidget::insertItem</a>().</p>
<p>This constructor inserts the item into the model of the parent that is passed to the constructor. If the model is sorted then the behavior of the insert is undetermined since the model will call the <code>'&lt;'</code> operator method on the item which, at this point, is not yet constructed. To avoid the undetermined behavior, we recommend not to specify the parent and use <a href="qlistwidget.html#insertItem">QListWidget::insertItem</a>() instead.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#type">type</a>().</p>
<!-- @@@QListWidgetItem -->
<!-- $$$QListWidgetItem$$$QListWidgetItemconstQListWidgetItem& -->
<h3 class="fn" id="QListWidgetItem-3"><a name="QListWidgetItem-3"></a>QListWidgetItem::<span class="name">QListWidgetItem</span>(const <span class="type"><a href="qlistwidgetitem.html#QListWidgetItem">QListWidgetItem</a></span> &amp;<i>other</i>)</h3>
<p>Constructs a copy of <i>other</i>. Note that <a href="qlistwidgetitem.html#type">type</a>() and <a href="qlistwidgetitem.html#listWidget">listWidget</a>() are not copied.</p>
<p>This function is useful when reimplementing <a href="qlistwidgetitem.html#clone">clone</a>().</p>
<p>This function was introduced in  Qt 4.1.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#data">data</a>() and <a href="qlistwidgetitem.html#flags">flags</a>().</p>
<!-- @@@QListWidgetItem -->
<!-- $$$~QListWidgetItem[overload1]$$$~QListWidgetItem -->
<h3 class="fn" id="dtor.QListWidgetItem"><a name="dtor.QListWidgetItem"></a><code>[virtual] </code>QListWidgetItem::<span class="name">~QListWidgetItem</span>()</h3>
<p>Destroys the list item.</p>
<!-- @@@~QListWidgetItem -->
<!-- $$$background[overload1]$$$background -->
<h3 class="fn" id="background"><a name="background"></a><span class="type"><a href="../qtgui/qbrush.html">QBrush</a></span> QListWidgetItem::<span class="name">background</span>() const</h3>
<p>Returns the brush used to display the list item's background.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#setBackground">setBackground</a>() and <a href="qlistwidgetitem.html#foreground">foreground</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> QListWidgetItem::<span class="name">checkState</span>() const</h3>
<p>Returns the checked state of the list item (see <a href="../qtcore/qt.html#CheckState-enum">Qt::CheckState</a>).</p>
<p><b>See also </b><a href="qlistwidgetitem.html#setCheckState">setCheckState</a>() and <a href="qlistwidgetitem.html#flags">flags</a>().</p>
<!-- @@@checkState -->
<!-- $$$clone[overload1]$$$clone -->
<h3 class="fn" id="clone"><a name="clone"></a><code>[virtual] </code><span class="type"><a href="qlistwidgetitem.html#QListWidgetItem">QListWidgetItem</a></span> *QListWidgetItem::<span class="name">clone</span>() const</h3>
<p>Creates an exact copy of the item.</p>
<!-- @@@clone -->
<!-- $$$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> QListWidgetItem::<span class="name">data</span>(<span class="type">int</span> <i>role</i>) const</h3>
<p>Returns the item's data for a given <i>role</i>. Reimplement this function if you need extra roles or special behavior for certain roles.</p>
<p><b>See also </b><a href="../qtcore/qt.html#ItemDataRole-enum">Qt::ItemDataRole</a> and <a href="qlistwidgetitem.html#setData">setData</a>().</p>
<!-- @@@data -->
<!-- $$$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> QListWidgetItem::<span class="name">flags</span>() const</h3>
<p>Returns the item flags for this item (see <a href="../qtcore/qt.html#ItemFlag-enum">Qt::ItemFlags</a>).</p>
<p><b>See also </b><a href="qlistwidgetitem.html#setFlags">setFlags</a>().</p>
<!-- @@@flags -->
<!-- $$$font[overload1]$$$font -->
<h3 class="fn" id="font"><a name="font"></a><span class="type"><a href="../qtgui/qfont.html">QFont</a></span> QListWidgetItem::<span class="name">font</span>() const</h3>
<p>Returns the font used to display this list item's text.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#setFont">setFont</a>().</p>
<!-- @@@font -->
<!-- $$$foreground[overload1]$$$foreground -->
<h3 class="fn" id="foreground"><a name="foreground"></a><span class="type"><a href="../qtgui/qbrush.html">QBrush</a></span> QListWidgetItem::<span class="name">foreground</span>() const</h3>
<p>Returns the brush used to display the list item's foreground (e.g&#x2e; text).</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#setForeground">setForeground</a>() and <a href="qlistwidgetitem.html#background">background</a>().</p>
<!-- @@@foreground -->
<!-- $$$icon[overload1]$$$icon -->
<h3 class="fn" id="icon"><a name="icon"></a><span class="type"><a href="../qtgui/qicon.html">QIcon</a></span> QListWidgetItem::<span class="name">icon</span>() const</h3>
<p>Returns the list item's icon.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#setIcon">setIcon</a>() and <a href="qabstractitemview.html#iconSize-prop">iconSize</a>.</p>
<!-- @@@icon -->
<!-- $$$isHidden[overload1]$$$isHidden -->
<h3 class="fn" id="isHidden"><a name="isHidden"></a><span class="type">bool</span> QListWidgetItem::<span class="name">isHidden</span>() const</h3>
<p>Returns <code>true</code> if the item is hidden; otherwise returns <code>false</code>.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#setHidden">setHidden</a>().</p>
<!-- @@@isHidden -->
<!-- $$$isSelected[overload1]$$$isSelected -->
<h3 class="fn" id="isSelected"><a name="isSelected"></a><span class="type">bool</span> QListWidgetItem::<span class="name">isSelected</span>() const</h3>
<p>Returns <code>true</code> if the item is selected; otherwise returns <code>false</code>.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#setSelected">setSelected</a>().</p>
<!-- @@@isSelected -->
<!-- $$$listWidget[overload1]$$$listWidget -->
<h3 class="fn" id="listWidget"><a name="listWidget"></a><span class="type"><a href="qlistwidget.html">QListWidget</a></span> *QListWidgetItem::<span class="name">listWidget</span>() const</h3>
<p>Returns the list widget containing the item.</p>
<!-- @@@listWidget -->
<!-- $$$read[overload1]$$$readQDataStream& -->
<h3 class="fn" id="read"><a name="read"></a><code>[virtual] </code><span class="type">void</span> QListWidgetItem::<span class="name">read</span>(<span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &amp;<i>in</i>)</h3>
<p>Reads the item from stream <i>in</i>.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#write">write</a>().</p>
<!-- @@@read -->
<!-- $$$setBackground[overload1]$$$setBackgroundconstQBrush& -->
<h3 class="fn" id="setBackground"><a name="setBackground"></a><span class="type">void</span> QListWidgetItem::<span class="name">setBackground</span>(const <span class="type"><a href="../qtgui/qbrush.html">QBrush</a></span> &amp;<i>brush</i>)</h3>
<p>Sets the background brush of the list item to the given <i>brush</i>.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#background">background</a>() and <a href="qlistwidgetitem.html#setForeground">setForeground</a>().</p>
<!-- @@@setBackground -->
<!-- $$$setCheckState[overload1]$$$setCheckStateQt::CheckState -->
<h3 class="fn" id="setCheckState"><a name="setCheckState"></a><span class="type">void</span> QListWidgetItem::<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 list item to <i>state</i>.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#checkState">checkState</a>().</p>
<!-- @@@setCheckState -->
<!-- $$$setData[overload1]$$$setDataintconstQVariant& -->
<h3 class="fn" id="setData"><a name="setData"></a><code>[virtual] </code><span class="type">void</span> QListWidgetItem::<span class="name">setData</span>(<span class="type">int</span> <i>role</i>, const <span class="type"><a href="../qtcore/qvariant.html">QVariant</a></span> &amp;<i>value</i>)</h3>
<p>Sets the data for a given <i>role</i> to the given <i>value</i>. Reimplement this function if you need extra roles or special behavior for certain roles.</p>
<p><b>See also </b><a href="../qtcore/qt.html#ItemDataRole-enum">Qt::ItemDataRole</a> and <a href="qlistwidgetitem.html#data">data</a>().</p>
<!-- @@@setData -->
<!-- $$$setFlags[overload1]$$$setFlagsQt::ItemFlags -->
<h3 class="fn" id="setFlags"><a name="setFlags"></a><span class="type">void</span> QListWidgetItem::<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 list item to <i>flags</i>.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#flags">flags</a>() and <a href="../qtcore/qt.html#ItemFlag-enum">Qt::ItemFlags</a>.</p>
<!-- @@@setFlags -->
<!-- $$$setFont[overload1]$$$setFontconstQFont& -->
<h3 class="fn" id="setFont"><a name="setFont"></a><span class="type">void</span> QListWidgetItem::<span class="name">setFont</span>(const <span class="type"><a href="../qtgui/qfont.html">QFont</a></span> &amp;<i>font</i>)</h3>
<p>Sets the font used when painting the item to the given <i>font</i>.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#font">font</a>().</p>
<!-- @@@setFont -->
<!-- $$$setForeground[overload1]$$$setForegroundconstQBrush& -->
<h3 class="fn" id="setForeground"><a name="setForeground"></a><span class="type">void</span> QListWidgetItem::<span class="name">setForeground</span>(const <span class="type"><a href="../qtgui/qbrush.html">QBrush</a></span> &amp;<i>brush</i>)</h3>
<p>Sets the foreground brush of the list item to the given <i>brush</i>.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#foreground">foreground</a>() and <a href="qlistwidgetitem.html#setBackground">setBackground</a>().</p>
<!-- @@@setForeground -->
<!-- $$$setHidden[overload1]$$$setHiddenbool -->
<h3 class="fn" id="setHidden"><a name="setHidden"></a><span class="type">void</span> QListWidgetItem::<span class="name">setHidden</span>(<span class="type">bool</span> <i>hide</i>)</h3>
<p>Hides the item if <i>hide</i> is true; otherwise shows the item.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#isHidden">isHidden</a>().</p>
<!-- @@@setHidden -->
<!-- $$$setIcon[overload1]$$$setIconconstQIcon& -->
<h3 class="fn" id="setIcon"><a name="setIcon"></a><span class="type">void</span> QListWidgetItem::<span class="name">setIcon</span>(const <span class="type"><a href="../qtgui/qicon.html">QIcon</a></span> &amp;<i>icon</i>)</h3>
<p>Sets the icon for the list item to the given <i>icon</i>.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#icon">icon</a>(), <a href="qlistwidgetitem.html#text">text</a>(), and <a href="qabstractitemview.html#iconSize-prop">iconSize</a>.</p>
<!-- @@@setIcon -->
<!-- $$$setSelected[overload1]$$$setSelectedbool -->
<h3 class="fn" id="setSelected"><a name="setSelected"></a><span class="type">void</span> QListWidgetItem::<span class="name">setSelected</span>(<span class="type">bool</span> <i>select</i>)</h3>
<p>Sets the selected state of the item to <i>select</i>.</p>
<p>This function was introduced in  Qt 4.2.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#isSelected">isSelected</a>().</p>
<!-- @@@setSelected -->
<!-- $$$setSizeHint[overload1]$$$setSizeHintconstQSize& -->
<h3 class="fn" id="setSizeHint"><a name="setSizeHint"></a><span class="type">void</span> QListWidgetItem::<span class="name">setSizeHint</span>(const <span class="type"><a href="../qtcore/qsize.html">QSize</a></span> &amp;<i>size</i>)</h3>
<p>Sets the size hint for the list 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>This function was introduced in  Qt 4.1.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#sizeHint">sizeHint</a>().</p>
<!-- @@@setSizeHint -->
<!-- $$$setStatusTip[overload1]$$$setStatusTipconstQString& -->
<h3 class="fn" id="setStatusTip"><a name="setStatusTip"></a><span class="type">void</span> QListWidgetItem::<span class="name">setStatusTip</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>statusTip</i>)</h3>
<p>Sets the status tip for the list item to the text specified by <i>statusTip</i>. <a href="qlistwidget.html">QListWidget</a> mouseTracking needs to be enabled for this feature to work.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#statusTip">statusTip</a>(), <a href="qlistwidgetitem.html#setToolTip">setToolTip</a>(), <a href="qlistwidgetitem.html#setWhatsThis">setWhatsThis</a>(), and <a href="qwidget.html#mouseTracking-prop">QWidget::setMouseTracking</a>().</p>
<!-- @@@setStatusTip -->
<!-- $$$setText[overload1]$$$setTextconstQString& -->
<h3 class="fn" id="setText"><a name="setText"></a><span class="type">void</span> QListWidgetItem::<span class="name">setText</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>text</i>)</h3>
<p>Sets the text for the list widget item's to the given <i>text</i>.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#text">text</a>().</p>
<!-- @@@setText -->
<!-- $$$setTextAlignment[overload1]$$$setTextAlignmentint -->
<h3 class="fn" id="setTextAlignment"><a name="setTextAlignment"></a><span class="type">void</span> QListWidgetItem::<span class="name">setTextAlignment</span>(<span class="type">int</span> <i>alignment</i>)</h3>
<p>Sets the list item's text alignment to <i>alignment</i>.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#textAlignment">textAlignment</a>() and <a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignmentFlag</a>.</p>
<!-- @@@setTextAlignment -->
<!-- $$$setToolTip[overload1]$$$setToolTipconstQString& -->
<h3 class="fn" id="setToolTip"><a name="setToolTip"></a><span class="type">void</span> QListWidgetItem::<span class="name">setToolTip</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>toolTip</i>)</h3>
<p>Sets the tooltip for the list item to the text specified by <i>toolTip</i>.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#toolTip">toolTip</a>(), <a href="qlistwidgetitem.html#setStatusTip">setStatusTip</a>(), and <a href="qlistwidgetitem.html#setWhatsThis">setWhatsThis</a>().</p>
<!-- @@@setToolTip -->
<!-- $$$setWhatsThis[overload1]$$$setWhatsThisconstQString& -->
<h3 class="fn" id="setWhatsThis"><a name="setWhatsThis"></a><span class="type">void</span> QListWidgetItem::<span class="name">setWhatsThis</span>(const <span class="type"><a href="../qtcore/qstring.html">QString</a></span> &amp;<i>whatsThis</i>)</h3>
<p>Sets the &quot;What's This?&quot; help for the list item to the text specified by <i>whatsThis</i>.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#whatsThis">whatsThis</a>(), <a href="qlistwidgetitem.html#setStatusTip">setStatusTip</a>(), and <a href="qlistwidgetitem.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> QListWidgetItem::<span class="name">sizeHint</span>() const</h3>
<p>Returns the size hint set for the list item.</p>
<p>This function was introduced in  Qt 4.1.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#setSizeHint">setSizeHint</a>().</p>
<!-- @@@sizeHint -->
<!-- $$$statusTip[overload1]$$$statusTip -->
<h3 class="fn" id="statusTip"><a name="statusTip"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QListWidgetItem::<span class="name">statusTip</span>() const</h3>
<p>Returns the list item's status tip.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#setStatusTip">setStatusTip</a>().</p>
<!-- @@@statusTip -->
<!-- $$$text[overload1]$$$text -->
<h3 class="fn" id="text"><a name="text"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QListWidgetItem::<span class="name">text</span>() const</h3>
<p>Returns the list item's text.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#setText">setText</a>().</p>
<!-- @@@text -->
<!-- $$$textAlignment[overload1]$$$textAlignment -->
<h3 class="fn" id="textAlignment"><a name="textAlignment"></a><span class="type">int</span> QListWidgetItem::<span class="name">textAlignment</span>() const</h3>
<p>Returns the text alignment for the list item.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#setTextAlignment">setTextAlignment</a>() and <a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignmentFlag</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> QListWidgetItem::<span class="name">toolTip</span>() const</h3>
<p>Returns the list item's tooltip.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#setToolTip">setToolTip</a>(), <a href="qlistwidgetitem.html#statusTip">statusTip</a>(), and <a href="qlistwidgetitem.html#whatsThis">whatsThis</a>().</p>
<!-- @@@toolTip -->
<!-- $$$type[overload1]$$$type -->
<h3 class="fn" id="type"><a name="type"></a><span class="type">int</span> QListWidgetItem::<span class="name">type</span>() const</h3>
<p>Returns the type passed to the <a href="qlistwidgetitem.html">QListWidgetItem</a> constructor.</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> QListWidgetItem::<span class="name">whatsThis</span>() const</h3>
<p>Returns the list item's &quot;What's This?&quot; help text.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#setWhatsThis">setWhatsThis</a>(), <a href="qlistwidgetitem.html#statusTip">statusTip</a>(), and <a href="qlistwidgetitem.html#toolTip">toolTip</a>().</p>
<!-- @@@whatsThis -->
<!-- $$$write[overload1]$$$writeQDataStream& -->
<h3 class="fn" id="write"><a name="write"></a><code>[virtual] </code><span class="type">void</span> QListWidgetItem::<span class="name">write</span>(<span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &amp;<i>out</i>) const</h3>
<p>Writes the item to stream <i>out</i>.</p>
<p><b>See also </b><a href="qlistwidgetitem.html#read">read</a>().</p>
<!-- @@@write -->
<!-- $$$operator<[overload1]$$$operator<constQListWidgetItem& -->
<h3 class="fn" id="operator-lt"><a name="operator-lt"></a><code>[virtual] </code><span class="type">bool</span> QListWidgetItem::<span class="name">operator&lt;</span>(const <span class="type"><a href="qlistwidgetitem.html#QListWidgetItem">QListWidgetItem</a></span> &amp;<i>other</i>) const</h3>
<p>Returns <code>true</code> if this item's text is less then <i>other</i> item's text; otherwise returns <code>false</code>.</p>
<!-- @@@operator< -->
<!-- $$$operator=[overload1]$$$operator=constQListWidgetItem& -->
<h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qlistwidgetitem.html#QListWidgetItem">QListWidgetItem</a></span> &amp;QListWidgetItem::<span class="name">operator=</span>(const <span class="type"><a href="qlistwidgetitem.html#QListWidgetItem">QListWidgetItem</a></span> &amp;<i>other</i>)</h3>
<p>Assigns <i>other</i>'s data and flags to this item. Note that <a href="qlistwidgetitem.html#type">type</a>() and <a href="qlistwidgetitem.html#listWidget">listWidget</a>() are not copied.</p>
<p>This function is useful when reimplementing <a href="qlistwidgetitem.html#clone">clone</a>().</p>
<p><b>See also </b><a href="qlistwidgetitem.html#data">data</a>() and <a href="qlistwidgetitem.html#flags">flags</a>().</p>
<!-- @@@operator= -->
</div>
<div class="relnonmem">
<h2>Related Non-Members</h2>
<!-- $$$operator<<[overload1]$$$operator<<QDataStream&constQListWidgetItem& -->
<h3 class="fn" id="operator-lt-lt"><a name="operator-lt-lt"></a><span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &amp;<span class="name">operator&lt;&lt;</span>(<span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &amp;<i>out</i>, const <span class="type"><a href="qlistwidgetitem.html#QListWidgetItem">QListWidgetItem</a></span> &amp;<i>item</i>)</h3>
<p>Writes the list widget item <i>item</i> to stream <i>out</i>.</p>
<p>This operator uses <a href="qlistwidgetitem.html#write">QListWidgetItem::write</a>().</p>
<p><b>See also </b><a href="../qtcore/datastreamformat.html">Serializing Qt Data Types</a>.</p>
<!-- @@@operator<< -->
<!-- $$$operator>>[overload1]$$$operator>>QDataStream&QListWidgetItem& -->
<h3 class="fn" id="operator-gt-gt"><a name="operator-gt-gt"></a><span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &amp;<span class="name">operator&gt;&gt;</span>(<span class="type"><a href="../qtcore/qdatastream.html">QDataStream</a></span> &amp;<i>in</i>, <span class="type"><a href="qlistwidgetitem.html#QListWidgetItem">QListWidgetItem</a></span> &amp;<i>item</i>)</h3>
<p>Reads a list widget item from stream <i>in</i> into <i>item</i>.</p>
<p>This operator uses <a href="qlistwidgetitem.html#read">QListWidgetItem::read</a>().</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">&copy;</acronym> 2017 The Qt Company Ltd.
   Documentation contributions included herein are the copyrights of
   their respective owners.<br>    The documentation provided herein is licensed under the terms of the    <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation    License version 1.3</a> as published by the Free Software Foundation.<br>    Qt and respective logos are trademarks of The Qt Company Ltd.     in Finland and/or other countries worldwide. All other trademarks are property
   of their respective owners. </p>
</div>
</body>
</html>