<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- /tmp/qt-4.2.1-harald-1161357942206/qt-x11-opensource-src-4.2.1/src/gui/styles/qstyleoption.cpp --> <head> <title>Qt 4.2: QStyleOptionViewItem Class Reference</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="mainclasses.html"><font color="#004faf">Main Classes</font></a> · <a href="groups.html"><font color="#004faf">Grouped Classes</font></a> · <a href="modules.html"><font color="#004faf">Modules</font></a> · <a href="functions.html"><font color="#004faf">Functions</font></a></td> <td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QStyleOptionViewItem Class Reference<br /><sup><sup>[<a href="qtgui.html">QtGui</a> module]</sup></sup></h1> <p>The QStyleOptionViewItem class is used to describe the parameters used to draw an item in a view widget. <a href="#details">More...</a></p> <pre> #include <QStyleOptionViewItem></pre><p>Inherits <a href="qstyleoption.html">QStyleOption</a>.</p> <p>Inherited by <a href="qstyleoptionviewitemv2.html">QStyleOptionViewItemV2</a>.</p> <ul> <li><a href="qstyleoptionviewitem-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-types"></a> <h3>Public Types</h3> <ul> <li><div class="fn"/>enum <b><a href="qstyleoptionviewitem.html#Position-enum">Position</a></b> { Left, Right, Top, Bottom }</li> <li><div class="fn"/>enum <b><a href="qstyleoptionviewitem.html#StyleOptionType-enum">StyleOptionType</a></b> { Type }</li> <li><div class="fn"/>enum <b><a href="qstyleoptionviewitem.html#StyleOptionVersion-enum">StyleOptionVersion</a></b> { Version }</li> </ul> <a name="public-functions"></a> <h3>Public Functions</h3> <ul> <li><div class="fn"/><b><a href="qstyleoptionviewitem.html#QStyleOptionViewItem">QStyleOptionViewItem</a></b> ()</li> <li><div class="fn"/><b><a href="qstyleoptionviewitem.html#QStyleOptionViewItem-2">QStyleOptionViewItem</a></b> ( const QStyleOptionViewItem & <i>other</i> )</li> </ul> <ul> <li><div class="fn"/>2 public functions inherited from <a href="qstyleoption.html#public-functions">QStyleOption</a></li> </ul> <a name="public-variables"></a> <h3>Public Variables</h3> <ul> <li><div class="fn"/>Qt::Alignment <b><a href="qstyleoptionviewitem.html#decorationAlignment-var">decorationAlignment</a></b></li> <li><div class="fn"/>Position <b><a href="qstyleoptionviewitem.html#decorationPosition-var">decorationPosition</a></b></li> <li><div class="fn"/>QSize <b><a href="qstyleoptionviewitem.html#decorationSize-var">decorationSize</a></b></li> <li><div class="fn"/>Qt::Alignment <b><a href="qstyleoptionviewitem.html#displayAlignment-var">displayAlignment</a></b></li> <li><div class="fn"/>QFont <b><a href="qstyleoptionviewitem.html#font-var">font</a></b></li> <li><div class="fn"/>bool <b><a href="qstyleoptionviewitem.html#showDecorationSelected-var">showDecorationSelected</a></b></li> <li><div class="fn"/>Qt::TextElideMode <b><a href="qstyleoptionviewitem.html#textElideMode-var">textElideMode</a></b></li> </ul> <ul> <li><div class="fn"/>7 public variables inherited from <a href="qstyleoption.html#public-variables">QStyleOption</a></li> </ul> <a name="details"></a> <hr /> <h2>Detailed Description</h2> <p>The QStyleOptionViewItem class is used to describe the parameters used to draw an item in a view widget.</p> <p>QStyleOptionViewItem contains all the information that <a href="qstyle.html">QStyle</a> functions need to draw the items for Qt's model/view classes.</p> <p>For performance reasons, the access to the member variables is direct (i.e., using the <tt>.</tt> or <tt>-></tt> operator). This low-level feel makes the structures straightforward to use and emphasizes that these are simply parameters used by the style functions.</p> <p>For an example demonstrating how style options can be used, see the <a href="widgets-styles.html">Styles</a> example.</p> <p>See also <a href="qstyleoption.html">QStyleOption</a> and <a href="model-view-programming.html">Model/View Programming</a>.</p> <hr /> <h2>Member Type Documentation</h2> <h3 class="fn"><a name="Position-enum"></a>enum QStyleOptionViewItem::Position</h3> <p>This enum describes the position of the item's decoration.</p> <p><table border="1" cellpadding="2" cellspacing="1" width="100%"> <tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr> <tr><td valign="top"><tt>QStyleOptionViewItem::Left</tt></td><td align="center" valign="top"><tt>0</tt></td><td valign="top">On the left of the text.</td></tr> <tr><td valign="top"><tt>QStyleOptionViewItem::Right</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">On the right of the text.</td></tr> <tr><td valign="top"><tt>QStyleOptionViewItem::Top</tt></td><td align="center" valign="top"><tt>2</tt></td><td valign="top">Above the text.</td></tr> <tr><td valign="top"><tt>QStyleOptionViewItem::Bottom</tt></td><td align="center" valign="top"><tt>3</tt></td><td valign="top">Below the text.</td></tr> </table></p> <p>See also <a href="qstyleoptionviewitem.html#decorationPosition-var">decorationPosition</a>.</p> <h3 class="fn"><a name="StyleOptionType-enum"></a>enum QStyleOptionViewItem::StyleOptionType</h3> <p>This enum is used to hold information about the type of the style option, and is defined for each <a href="qstyleoption.html">QStyleOption</a> subclass.</p> <p><table border="1" cellpadding="2" cellspacing="1" width="100%"> <tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr> <tr><td valign="top"><tt>QStyleOptionViewItem::Type</tt></td><td align="center" valign="top"><tt>SO_ViewItem</tt></td><td valign="top">The type of style option provided (<a href="qstyleoption.html#OptionType-enum">SO_ViewItem</a> for this class).</td></tr> </table></p> <p>The type is used internally by <a href="qstyleoption.html">QStyleOption</a>, its subclasses, and <a href="qstyleoption.html#qstyleoption_cast">qstyleoption_cast</a>() to determine the type of style option. In general you do not need to worry about this unless you want to create your own <a href="qstyleoption.html">QStyleOption</a> subclass and your own styles.</p> <p>See also <a href="qstyleoptionviewitem.html#StyleOptionVersion-enum">StyleOptionVersion</a>.</p> <h3 class="fn"><a name="StyleOptionVersion-enum"></a>enum QStyleOptionViewItem::StyleOptionVersion</h3> <p>This enum is used to hold information about the version of the style option, and is defined for each <a href="qstyleoption.html">QStyleOption</a> subclass.</p> <p><table border="1" cellpadding="2" cellspacing="1" width="100%"> <tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr> <tr><td valign="top"><tt>QStyleOptionViewItem::Version</tt></td><td align="center" valign="top"><tt>1</tt></td><td valign="top">1</td></tr> </table></p> <p>The version is used by <a href="qstyleoption.html">QStyleOption</a> subclasses to implement extensions without breaking compatibility. If you use <a href="qstyleoption.html#qstyleoption_cast">qstyleoption_cast</a>(), you normally don't need to check it.</p> <p>See also <a href="qstyleoptionviewitem.html#StyleOptionType-enum">StyleOptionType</a>.</p> <hr /> <h2>Member Function Documentation</h2> <h3 class="fn"><a name="QStyleOptionViewItem"></a>QStyleOptionViewItem::QStyleOptionViewItem ()</h3> <p>Constructs a <a href="qstyleoptionviewitem.html">QStyleOptionViewItem</a>, initializing the members variables to their default values.</p> <h3 class="fn"><a name="QStyleOptionViewItem-2"></a>QStyleOptionViewItem::QStyleOptionViewItem ( const QStyleOptionViewItem & <i>other</i> )</h3> <p>Constructs a copy of the <i>other</i> style option.</p> <hr /> <h2>Member Variable Documentation</h2> <h3 class="fn"><a name="decorationAlignment-var"></a><a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a> QStyleOptionViewItem::decorationAlignment</h3> <p>This variable holds the alignment of the decoration for the item.</p> <p>The default value is <a href="qt.html#AlignmentFlag-enum">Qt::AlignLeft</a>.</p> <h3 class="fn"><a name="decorationPosition-var"></a><a href="qstyleoptionviewitem.html#Position-enum">Position</a> QStyleOptionViewItem::decorationPosition</h3> <p>This variable holds the position of the decoration for the item.</p> <p>The default value is <a href="qstyleoptionviewitem.html#Position-enum">Left</a>.</p> <p>See also <a href="qstyleoptionviewitem.html#Position-enum">Position</a>.</p> <h3 class="fn"><a name="decorationSize-var"></a><a href="qsize.html">QSize</a> QStyleOptionViewItem::decorationSize</h3> <p>This variable holds the size of the decoration for the item.</p> <p>The default value is <a href="qsize.html">QSize</a>(-1, -1), i.e. an invalid size.</p> <p>See also <a href="qstyleoptionviewitem.html#decorationAlignment-var">decorationAlignment</a> and <a href="qstyleoptionviewitem.html#decorationPosition-var">decorationPosition</a>.</p> <h3 class="fn"><a name="displayAlignment-var"></a><a href="qt.html#AlignmentFlag-enum">Qt::Alignment</a> QStyleOptionViewItem::displayAlignment</h3> <p>This variable holds the alignment of the display value for the item.</p> <p>The default value is <a href="qt.html#AlignmentFlag-enum">Qt::AlignLeft</a>.</p> <h3 class="fn"><a name="font-var"></a><a href="qfont.html">QFont</a> QStyleOptionViewItem::font</h3> <p>This variable holds the font used for the item.</p> <p>By default, the application's default font is used.</p> <p>See also <a href="qfont.html">QFont</a>.</p> <h3 class="fn"><a name="showDecorationSelected-var"></a>bool QStyleOptionViewItem::showDecorationSelected</h3> <p>This variable holds whether the decoration should be highlighted on selected items.</p> <p>If this option is true, the branch and any decorations on selected items should be highlighted, indicating that the item is selected; otherwise, no highlighting is required. The default value is false.</p> <p>See also <a href="qstyle.html#StyleHint-enum">QStyle::SH_ItemView_ShowDecorationSelected</a> and <a href="qabstractitemview.html">QAbstractItemView</a>.</p> <h3 class="fn"><a name="textElideMode-var"></a><a href="qt.html#TextElideMode-enum">Qt::TextElideMode</a> QStyleOptionViewItem::textElideMode</h3> <p>This variable holds where ellipsis should be added for text that is too long to fit into an item.</p> <p>The default value is <a href="qt.html#TextElideMode-enum">Qt::ElideMiddle</a>, i.e. the ellipsis appears in the middle of the text.</p> <p>See also <a href="qt.html#TextElideMode-enum">Qt::TextElideMode</a> and <a href="qstyle.html#StyleHint-enum">QStyle::SH_ItemView_EllipsisLocation</a>.</p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="30%">Copyright © 2006 <a href="trolltech.html">Trolltech</a></td> <td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="30%" align="right"><div align="right">Qt 4.2.1</div></td> </tr></table></div></address></body> </html>