<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- qstyleoption.cpp --> <title>QStyleOptionHeader Class | Qt Widgets 5.11</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 ><a href="../qtdoc/index.html">Qt 5.11</a></td><td ><a href="qtwidgets-index.html">Qt Widgets</a></td><td ><a href="qtwidgets-module.html">C++ Classes</a></td><td >QStyleOptionHeader</td></tr></table><table class="buildversion"><tr> <td id="buildversion" width="100%" align="right">Qt 5.11.2 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="#public-variables">Public Variables</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <div class="sidebar-content" id="sidebar-content"></div></div> <h1 class="title">QStyleOptionHeader Class</h1> <!-- $$$QStyleOptionHeader-brief --> <p>The <a href="qstyleoptionheader.html">QStyleOptionHeader</a> class is used to describe the parameters for drawing a header. <a href="#details">More...</a></p> <!-- @@@QStyleOptionHeader --> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QStyleOptionHeader></span> </td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += widgets</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Inherits:</td><td class="memItemRight bottomAlign"> <a href="qstyleoption.html">QStyleOption</a></td></tr></table></div><ul> <li><a href="qstyleoptionheader-members.html">List of all members, including inherited 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="qstyleoptionheader.html#SectionPosition-enum">SectionPosition</a></b> { Beginning, Middle, End, OnlyOneSection }</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptionheader.html#SelectedPosition-enum">SelectedPosition</a></b> { NotAdjacent, NextIsSelected, PreviousIsSelected, NextAndPreviousAreSelected }</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptionheader.html#SortIndicator-enum">SortIndicator</a></b> { None, SortUp, SortDown }</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptionheader.html#StyleOptionType-enum">StyleOptionType</a></b> { Type }</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptionheader.html#StyleOptionVersion-enum">StyleOptionVersion</a></b> { Version }</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="qstyleoptionheader.html#QStyleOptionHeader">QStyleOptionHeader</a></b>()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptionheader.html#QStyleOptionHeader-1">QStyleOptionHeader</a></b>(const QStyleOptionHeader &<i>other</i>)</td></tr> </table></div> <ul> <li class="fn">2 public functions inherited from <a href="qstyleoption.html#public-functions">QStyleOption</a></li> </ul> <a name="public-variables"></a> <h2 id="public-variables">Public Variables</h2> <div class="table"><table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> QIcon </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptionheader.html#icon-var">icon</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> Qt::Alignment </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptionheader.html#iconAlignment-var">iconAlignment</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> Qt::Orientation </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptionheader.html#orientation-var">orientation</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QStyleOptionHeader::SectionPosition </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptionheader.html#position-var">position</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> int </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptionheader.html#section-var">section</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QStyleOptionHeader::SelectedPosition </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptionheader.html#selectedPosition-var">selectedPosition</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QStyleOptionHeader::SortIndicator </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptionheader.html#sortIndicator-var">sortIndicator</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptionheader.html#text-var">text</a></b></td></tr> <tr><td class="memItemLeft rightAlign topAlign"> Qt::Alignment </td><td class="memItemRight bottomAlign"><b><a href="qstyleoptionheader.html#textAlignment-var">textAlignment</a></b></td></tr> </table></div> <ul> <li class="fn">8 public variables inherited from <a href="qstyleoption.html#public-variables">QStyleOption</a></li> </ul> <a name="details"></a> <!-- $$$QStyleOptionHeader-description --> <div class="descr"> <h2 id="details">Detailed Description</h2> <p>The <a href="qstyleoptionheader.html">QStyleOptionHeader</a> class is used to describe the parameters for drawing a header.</p> <p><a href="qstyleoptionheader.html">QStyleOptionHeader</a> contains all the information that <a href="qstyle.html">QStyle</a> functions need to draw the item views' header pane, header sort arrow, and header label.</p> <p>For performance reasons, the access to the member variables is direct (i.e., using the <code>.</code> or <code>-></code> 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="qtwidgets-widgets-styles-example.html">Styles</a> example.</p> </div> <p><b>See also </b><a href="qstyleoption.html">QStyleOption</a>.</p> <!-- @@@QStyleOptionHeader --> <div class="types"> <h2>Member Type Documentation</h2> <!-- $$$SectionPosition$$$Beginning$$$Middle$$$End$$$OnlyOneSection --> <h3 class="fn" id="SectionPosition-enum"><a name="SectionPosition-enum"></a>enum QStyleOptionHeader::<span class="name">SectionPosition</span></h3> <p>This enum lets you know where the section's position is in relation to the other sections.</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>QStyleOptionHeader::Beginning</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">At the beginining of the header</td></tr> <tr><td class="topAlign"><code>QStyleOptionHeader::Middle</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">In the middle of the header</td></tr> <tr><td class="topAlign"><code>QStyleOptionHeader::End</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">At the end of the header</td></tr> <tr><td class="topAlign"><code>QStyleOptionHeader::OnlyOneSection</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">Only one header section</td></tr> </table></div> <p><b>See also </b><a href="qstyleoptionheader.html#position-var">position</a>.</p> <!-- @@@SectionPosition --> <!-- $$$SelectedPosition$$$NotAdjacent$$$NextIsSelected$$$PreviousIsSelected$$$NextAndPreviousAreSelected --> <h3 class="fn" id="SelectedPosition-enum"><a name="SelectedPosition-enum"></a>enum QStyleOptionHeader::<span class="name">SelectedPosition</span></h3> <p>This enum lets you know where the section's position is in relation to the selected section.</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>QStyleOptionHeader::NotAdjacent</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">Not adjacent to the selected section</td></tr> <tr><td class="topAlign"><code>QStyleOptionHeader::NextIsSelected</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">The next section is selected</td></tr> <tr><td class="topAlign"><code>QStyleOptionHeader::PreviousIsSelected</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">The previous section is selected</td></tr> <tr><td class="topAlign"><code>QStyleOptionHeader::NextAndPreviousAreSelected</code></td><td class="topAlign tblval"><code>3</code></td><td class="topAlign">Both the next and previous section are selected</td></tr> </table></div> <p><b>See also </b><a href="qstyleoptionheader.html#selectedPosition-var">selectedPosition</a>.</p> <!-- @@@SelectedPosition --> <!-- $$$SortIndicator$$$None$$$SortUp$$$SortDown --> <h3 class="fn" id="SortIndicator-enum"><a name="SortIndicator-enum"></a>enum QStyleOptionHeader::<span class="name">SortIndicator</span></h3> <p>Indicates which direction the sort indicator should be drawn</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>QStyleOptionHeader::None</code></td><td class="topAlign tblval"><code>0</code></td><td class="topAlign">No sort indicator is needed</td></tr> <tr><td class="topAlign"><code>QStyleOptionHeader::SortUp</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">Draw an up indicator</td></tr> <tr><td class="topAlign"><code>QStyleOptionHeader::SortDown</code></td><td class="topAlign tblval"><code>2</code></td><td class="topAlign">Draw a down indicator</td></tr> </table></div> <p><b>See also </b><a href="qstyleoptionheader.html#sortIndicator-var">sortIndicator</a>.</p> <!-- @@@SortIndicator --> <!-- $$$StyleOptionType$$$Type --> <h3 class="fn" id="StyleOptionType-enum"><a name="StyleOptionType-enum"></a>enum QStyleOptionHeader::<span class="name">StyleOptionType</span></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> <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>QStyleOptionHeader::Type</code></td><td class="topAlign tblval"><code>SO_Header</code></td><td class="topAlign">The type of style option provided (<a href="qstyleoption.html#OptionType-enum">SO_Header</a> for this class).</td></tr> </table></div> <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><b>See also </b><a href="qstyleoptionheader.html#StyleOptionVersion-enum">StyleOptionVersion</a>.</p> <!-- @@@StyleOptionType --> <!-- $$$StyleOptionVersion$$$Version --> <h3 class="fn" id="StyleOptionVersion-enum"><a name="StyleOptionVersion-enum"></a>enum QStyleOptionHeader::<span class="name">StyleOptionVersion</span></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> <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>QStyleOptionHeader::Version</code></td><td class="topAlign tblval"><code>1</code></td><td class="topAlign">1</td></tr> </table></div> <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 do not need to check it.</p> <p><b>See also </b><a href="qstyleoptionheader.html#StyleOptionType-enum">StyleOptionType</a>.</p> <!-- @@@StyleOptionVersion --> </div> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QStyleOptionHeader[overload1]$$$QStyleOptionHeader --> <h3 class="fn" id="QStyleOptionHeader"><a name="QStyleOptionHeader"></a>QStyleOptionHeader::<span class="name">QStyleOptionHeader</span>()</h3> <p>Constructs a <a href="qstyleoptionheader.html">QStyleOptionHeader</a>, initializing the members variables to their default values.</p> <!-- @@@QStyleOptionHeader --> <!-- $$$QStyleOptionHeader$$$QStyleOptionHeaderconstQStyleOptionHeader& --> <h3 class="fn" id="QStyleOptionHeader-1"><a name="QStyleOptionHeader-1"></a>QStyleOptionHeader::<span class="name">QStyleOptionHeader</span>(const <span class="type"><a href="qstyleoptionheader.html#QStyleOptionHeader">QStyleOptionHeader</a></span> &<i>other</i>)</h3> <p>Constructs a copy of the <i>other</i> style option.</p> <!-- @@@QStyleOptionHeader --> </div> <div class="vars"> <h2>Member Variable Documentation</h2> <!-- $$$icon --> <h3 class="fn" id="icon-var"><a name="icon-var"></a><span class="type"><a href="../qtgui/qicon.html">QIcon</a></span> QStyleOptionHeader::<span class="name">icon</span></h3> <p>This variable holds the icon of the header</p> <p>The default value is an empty icon, i.e. an icon with neither a pixmap nor a filename.</p> <!-- @@@icon --> <!-- $$$iconAlignment --> <h3 class="fn" id="iconAlignment-var"><a name="iconAlignment-var"></a><span class="type">Qt::Alignment</span> QStyleOptionHeader::<span class="name">iconAlignment</span></h3> <p>This variable holds the alignment flags for the icon of the header</p> <p>The default value is <a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignLeft</a>.</p> <!-- @@@iconAlignment --> <!-- $$$orientation --> <h3 class="fn" id="orientation-var"><a name="orientation-var"></a><span class="type">Qt::Orientation</span> QStyleOptionHeader::<span class="name">orientation</span></h3> <p>This variable holds the header's orientation (horizontal or vertical)</p> <p>The default orientation is <a href="../qtcore/qt.html#Orientation-enum">Qt::Horizontal</a></p> <!-- @@@orientation --> <!-- $$$position --> <h3 class="fn" id="position-var"><a name="position-var"></a><span class="type"><a href="qstyleoptionheader.html#SectionPosition-enum">QStyleOptionHeader::SectionPosition</a></span> QStyleOptionHeader::<span class="name">position</span></h3> <p>This variable holds the section's position in relation to the other sections</p> <p>The default value is <a href="qstyleoptionheader.html#SectionPosition-enum">QStyleOptionHeader::Beginning</a>.</p> <!-- @@@position --> <!-- $$$section --> <h3 class="fn" id="section-var"><a name="section-var"></a><span class="type">int</span> QStyleOptionHeader::<span class="name">section</span></h3> <p>This variable holds which section of the header is being painted</p> <p>The default value is 0.</p> <!-- @@@section --> <!-- $$$selectedPosition --> <h3 class="fn" id="selectedPosition-var"><a name="selectedPosition-var"></a><span class="type"><a href="qstyleoptionheader.html#SelectedPosition-enum">QStyleOptionHeader::SelectedPosition</a></span> QStyleOptionHeader::<span class="name">selectedPosition</span></h3> <p>This variable holds the section's position in relation to the selected section</p> <p>The default value is <a href="qstyleoptionheader.html#SelectedPosition-enum">QStyleOptionHeader::NotAdjacent</a></p> <!-- @@@selectedPosition --> <!-- $$$sortIndicator --> <h3 class="fn" id="sortIndicator-var"><a name="sortIndicator-var"></a><span class="type"><a href="qstyleoptionheader.html#SortIndicator-enum">QStyleOptionHeader::SortIndicator</a></span> QStyleOptionHeader::<span class="name">sortIndicator</span></h3> <p>This variable holds the direction the sort indicator should be drawn</p> <p>The default value is <a href="qstyleoptionheader.html#SortIndicator-enum">QStyleOptionHeader::None</a>.</p> <!-- @@@sortIndicator --> <!-- $$$text --> <h3 class="fn" id="text-var"><a name="text-var"></a><span class="type"><a href="../qtcore/qstring.html">QString</a></span> QStyleOptionHeader::<span class="name">text</span></h3> <p>This variable holds the text of the header</p> <p>The default value is an empty string.</p> <!-- @@@text --> <!-- $$$textAlignment --> <h3 class="fn" id="textAlignment-var"><a name="textAlignment-var"></a><span class="type">Qt::Alignment</span> QStyleOptionHeader::<span class="name">textAlignment</span></h3> <p>This variable holds the alignment flags for the text of the header</p> <p>The default value is <a href="../qtcore/qt.html#AlignmentFlag-enum">Qt::AlignLeft</a>.</p> <!-- @@@textAlignment --> </div> </div> </div> </div> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2018 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>