<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> <!-- /tmp/qt-3.0-reggie-28534/qt-x11-free-3.0.2/src/widgets/qheader.cpp:136 --> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> <title>QHeader Class</title> <style type="text/css"><!-- h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; } a:link { color: #004faf; text-decoration: none } a:visited { color: #672967; text-decoration: none } body { background: #ffffff; color: black; } --></style> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr bgcolor="#E5E5E5"> <td 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="annotated.html"> <font color="#004faf">Annotated</font></a> | <a href="groups.html"> <font color="#004faf">Grouped Classes</font></a> | <a href="functions.html"> <font color="#004faf">Functions</font></a> </td> <td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>QHeader Class Reference</h1> <p>The QHeader class provides a header row or column, e.g. for tables and listviews. <a href="#details">More...</a> <p><tt>#include <<a href="qheader-h.html">qheader.h</a>></tt> <p>Inherits <a href="qwidget.html">QWidget</a>. <p><a href="qheader-members.html">List of all member functions.</a> <h2>Public Members</h2> <ul> <li><div class=fn><a href="#QHeader"><b>QHeader</b></a> ( QWidget * parent = 0, const char * name = 0 )</div></li> <li><div class=fn><a href="#QHeader-2"><b>QHeader</b></a> ( int n, QWidget * parent = 0, const char * name = 0 )</div></li> <li><div class=fn><a href="#~QHeader"><b>~QHeader</b></a> ()</div></li> <li><div class=fn>int <a href="#addLabel"><b>addLabel</b></a> ( const QString & s, int size = -1 )</div></li> <li><div class=fn>int <a href="#addLabel-2"><b>addLabel</b></a> ( const QIconSet & iconset, const QString & s, int size = -1 )</div></li> <li><div class=fn>void <a href="#removeLabel"><b>removeLabel</b></a> ( int section )</div></li> <li><div class=fn>virtual void <a href="#setLabel"><b>setLabel</b></a> ( int section, const QString & s, int size = -1 )</div></li> <li><div class=fn>virtual void <a href="#setLabel-2"><b>setLabel</b></a> ( int section, const QIconSet & iconset, const QString & s, int size = -1 )</div></li> <li><div class=fn>QString <a href="#label"><b>label</b></a> ( int section ) const</div></li> <li><div class=fn>QIconSet * <a href="#iconSet"><b>iconSet</b></a> ( int section ) const</div></li> <li><div class=fn>virtual void <a href="#setOrientation"><b>setOrientation</b></a> ( Orientation )</div></li> <li><div class=fn>Orientation <a href="#orientation"><b>orientation</b></a> () const</div></li> <li><div class=fn>virtual void <a href="#setTracking"><b>setTracking</b></a> ( bool enable )</div></li> <li><div class=fn>bool <a href="#tracking"><b>tracking</b></a> () const</div></li> <li><div class=fn>virtual void <a href="#setClickEnabled"><b>setClickEnabled</b></a> ( bool enable, int section = -1 )</div></li> <li><div class=fn>virtual void <a href="#setResizeEnabled"><b>setResizeEnabled</b></a> ( bool enable, int section = -1 )</div></li> <li><div class=fn>virtual void <a href="#setMovingEnabled"><b>setMovingEnabled</b></a> ( bool )</div></li> <li><div class=fn>virtual void <a href="#setStretchEnabled"><b>setStretchEnabled</b></a> ( bool b, int section )</div></li> <li><div class=fn>void <a href="#setStretchEnabled-2"><b>setStretchEnabled</b></a> ( bool b )</div></li> <li><div class=fn>bool <a href="#isClickEnabled"><b>isClickEnabled</b></a> ( int section = -1 ) const</div></li> <li><div class=fn>bool <a href="#isResizeEnabled"><b>isResizeEnabled</b></a> ( int section = -1 ) const</div></li> <li><div class=fn>bool <a href="#isMovingEnabled"><b>isMovingEnabled</b></a> () const</div></li> <li><div class=fn>bool <a href="#isStretchEnabled"><b>isStretchEnabled</b></a> () const</div></li> <li><div class=fn>bool <a href="#isStretchEnabled-2"><b>isStretchEnabled</b></a> ( int section ) const</div></li> <li><div class=fn>void <a href="#resizeSection"><b>resizeSection</b></a> ( int section, int s )</div></li> <li><div class=fn>int <a href="#sectionSize"><b>sectionSize</b></a> ( int section ) const</div></li> <li><div class=fn>int <a href="#sectionPos"><b>sectionPos</b></a> ( int section ) const</div></li> <li><div class=fn>int <a href="#sectionAt"><b>sectionAt</b></a> ( int pos ) const</div></li> <li><div class=fn>int <a href="#count"><b>count</b></a> () const</div></li> <li><div class=fn>int <a href="#headerWidth"><b>headerWidth</b></a> () const</div></li> <li><div class=fn>QRect <a href="#sectionRect"><b>sectionRect</b></a> ( int section ) const</div></li> <li><div class=fn>virtual void setCellSize ( int section, int s ) <em>(obsolete)</em></div></li> <li><div class=fn>int cellSize ( int i ) const <em>(obsolete)</em></div></li> <li><div class=fn>int cellPos ( int i ) const <em>(obsolete)</em></div></li> <li><div class=fn>int cellAt ( int pos ) const <em>(obsolete)</em></div></li> <li><div class=fn>int <a href="#offset"><b>offset</b></a> () const</div></li> <li><div class=fn>int <a href="#mapToSection"><b>mapToSection</b></a> ( int index ) const</div></li> <li><div class=fn>int <a href="#mapToIndex"><b>mapToIndex</b></a> ( int section ) const</div></li> <li><div class=fn>int mapToLogical ( int a ) const <em>(obsolete)</em></div></li> <li><div class=fn>int mapToActual ( int l ) const <em>(obsolete)</em></div></li> <li><div class=fn>void <a href="#moveSection"><b>moveSection</b></a> ( int section, int toIndex )</div></li> <li><div class=fn>virtual void moveCell ( int fromIdx, int toIdx ) <em>(obsolete)</em></div></li> <li><div class=fn>void <a href="#setSortIndicator"><b>setSortIndicator</b></a> ( int section, bool increasing = TRUE )</div></li> <li><div class=fn>void <a href="#adjustHeaderSize"><b>adjustHeaderSize</b></a> ()</div></li> </ul> <h2>Public Slots</h2> <ul> <li><div class=fn>virtual void <a href="#setOffset"><b>setOffset</b></a> ( int pos )</div></li> </ul> <h2>Signals</h2> <ul> <li><div class=fn>void <a href="#clicked"><b>clicked</b></a> ( int section )</div></li> <li><div class=fn>void <a href="#pressed"><b>pressed</b></a> ( int section )</div></li> <li><div class=fn>void <a href="#released"><b>released</b></a> ( int section )</div></li> <li><div class=fn>void <a href="#sizeChange"><b>sizeChange</b></a> ( int section, int oldSize, int newSize )</div></li> <li><div class=fn>void <a href="#indexChange"><b>indexChange</b></a> ( int section, int fromIndex, int toIndex )</div></li> <li><div class=fn>void sectionClicked ( int index ) <em>(obsolete)</em></div></li> <li><div class=fn>void moved ( int fromIndex, int toIndex ) <em>(obsolete)</em></div></li> </ul> <h2>Properties</h2> <ul> <li><div class=fn>int <a href="#count-prop"><b>count</b></a> - the number of sections in the header <em>(read only)</em></div></li> <li><div class=fn>bool <a href="#moving-prop"><b>moving</b></a> - whether the header sections can be moved</div></li> <li><div class=fn>int <a href="#offset-prop"><b>offset</b></a> - the header's leftmost (or topmost) visible pixel</div></li> <li><div class=fn>Orientation <a href="#orientation-prop"><b>orientation</b></a> - the header's physical orientation</div></li> <li><div class=fn>bool <a href="#stretching-prop"><b>stretching</b></a> - whether the header sections always take up the full width (or height) of the header</div></li> <li><div class=fn>bool <a href="#tracking-prop"><b>tracking</b></a> - whether the sizeChange() signal is emitted continuously</div></li> </ul> <h2>Protected Members</h2> <ul> <li><div class=fn>QRect <a href="#sRect"><b>sRect</b></a> ( int index )</div></li> <li><div class=fn>virtual void <a href="#paintSection"><b>paintSection</b></a> ( QPainter * p, int index, const QRect & fr )</div></li> <li><div class=fn>virtual void <a href="#paintSectionLabel"><b>paintSectionLabel</b></a> ( QPainter * p, int index, const QRect & fr )</div></li> </ul> <hr><a name="details"></a><h2>Detailed Description</h2> The QHeader class provides a header row or column, e.g. for tables and listviews. <p> This class provides a header, e.g. a vertical header to display row labels, or a horizontal header to display column labels. It is used by <a href="qtable.html">QTable</a> and <a href="qlistview.html">QListView</a> for example. <p> A header is composed of one or more <em>sections</em>, each of which may display a text label and an iconset. A sort indicator (an arrow) may also be displayed using <a href="#setSortIndicator">setSortIndicator</a>(). <p> Sections are added with <a href="#addLabel">addLabel</a>() and removed with <a href="#removeLabel">removeLabel</a>(). The label and iconset are set in addLabel() and can be changed later with <a href="#setLabel">setLabel</a>(). Use <a href="#count">count</a>() to retrieve the number of sections in the header. <p> The orientation of the header is set with <a href="#setOrientation">setOrientation</a>(). If <a href="#setStretchEnabled">setStretchEnabled</a>() is TRUE, the sections will expand to take up the full width (height for vertical headers) of the header. The user can resize the sections manually if <a href="#setResizeEnabled">setResizeEnabled</a>() is TRUE. Call <a href="#adjustHeaderSize">adjustHeaderSize</a>() to have the sections resize to occupy the full width (or height). <p> A section can be moved with <a href="#moveSection">moveSection</a>(). If <a href="#setMovingEnabled">setMovingEnabled</a>() is TRUE the user may drag a section from one position to another. If a section is moved, the index positions at which sections were added (with <a href="#addLabel">addLabel</a>()), may not be the same after the move. You don't have to worry about this in practice because the QHeader API works in terms of section numbers, so it doesn't matter where a particular section has been moved to. <p> If you want the current index position of a section call <a href="#mapToIndex">mapToIndex</a>() giving it the section number. (This is the number returned by the addLabel() call which created the section.) If you want to get the section number of a section at a particular index position call <a href="#mapToSection">mapToSection</a>() giving it the index number. <p> Here's an example to clarify mapToSection() and mapToIndex(): <p> <center><table cellpadding="4" cellspacing="2" border="0"> <tr bgcolor="#a2c511"> <th valign="top" colspan="4" rowspan="1"> Index positions <tr bgcolor="#f0f0f0"> <td valign="top">0 <td valign="top">1 <td valign="top">2 <td valign="top">3 <tr bgcolor="#a2c511"> <th valign="top" colspan="4" rowspan="1"> Original section ordering <tr bgcolor="#d0d0d0"> <td valign="top">Sect 0 <td valign="top">Sect 1 <td valign="top">Sect 2 <td valign="top">Sect 3 <tr bgcolor="#a2c511"> <th valign="top" colspan="4" rowspan="1"> Ordering after the user moves a section <tr bgcolor="#f0f0f0"> <td valign="top">Sect 0 <td valign="top">Sect 2 <td valign="top">Sect 3 <td valign="top">Sect 1 </table></center> <p> <center><table cellpadding="4" cellspacing="2" border="0"> <tr bgcolor="#a2c511"> <th valign="top"><em>k</em> <th valign="top">mapToSection(<em>k</em>) <th valign="top">mapToIndex(<em>k</em>) <tr bgcolor="#d0d0d0"> <td valign="top">0 <td valign="top">0 <td valign="top">0 <tr bgcolor="#f0f0f0"> <td valign="top">1 <td valign="top">2 <td valign="top">3 <tr bgcolor="#d0d0d0"> <td valign="top">2 <td valign="top">3 <td valign="top">1 <tr bgcolor="#f0f0f0"> <td valign="top">3 <td valign="top">1 <td valign="top">2 </table></center> <p> In the example above, if we wanted to find out which section is at index position 3 we'd call <a href="#mapToSection">mapToSection</a>(3) and get a section number of 1 since section 1 was moved. Similarly, if we wanted to know which index position section 2 occupied we'd call <a href="#mapToIndex">mapToIndex</a>(2) and get an index of 1. <p> QHeader provides the <a href="#clicked">clicked</a>(), <a href="#pressed">pressed</a>() and <a href="#released">released</a>() signals. If the user changes the size of a section, the <a href="#sizeChange">sizeChange</a>() signal is emitted. If you want to have a sizeChange() signal emitted continuously whilst the user is resizing (rather than just after the resizing is finished), use <a href="#setTracking">setTracking</a>(). If the user moves a section the <a href="#indexChange">indexChange</a>() signal is emitted. <p> <img src=qheader-m.png> <img src=qheader-w.png> <p> <p>See also <a href="qlistview.html">QListView</a>, <a href="qtable.html">QTable</a> and <a href="advanced.html">Advanced Widgets</a>. <hr><h2>Member Function Documentation</h2> <h3 class=fn><a name="QHeader"></a>QHeader::QHeader ( <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0 ) </h3> Constructs a horizontal header called <em>name</em>, with parent <em>parent</em>. <p> <h3 class=fn><a name="QHeader-2"></a>QHeader::QHeader ( int n, <a href="qwidget.html">QWidget</a> * parent = 0, const char * name = 0 ) </h3> Constructs a horizontal header called <em>name</em>, with <em>n</em> sections and parent <em>parent</em>. <p> <h3 class=fn><a name="~QHeader"></a>QHeader::~QHeader () </h3> Destroys the header and all its sections. <h3 class=fn>int <a name="addLabel"></a>QHeader::addLabel ( const <a href="qstring.html">QString</a> & s, int size = -1 ) </h3> Adds a new section with label text <em>s</em>. Returns the index position where the section was added (at the right for horizontal headers, at the bottom for vertical headers). The section's width is set to <em>size</em>. If <em>size</em> < 0, an appropriate size for the text <em>s</em> is chosen. <h3 class=fn>int <a name="addLabel-2"></a>QHeader::addLabel ( const <a href="qiconset.html">QIconSet</a> & iconset, const <a href="qstring.html">QString</a> & s, int size = -1 ) </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Adds a new section with iconset <em>iconset</em> and label text <em>s</em>. Returns the index position where the section was added (at the right for horizontal headers, at the bottom for vertical headers). The section's width is set to <em>size</em>, unless size is negative in which case the size is calculated taking account of the size of the text. <p> <h3 class=fn>void <a name="adjustHeaderSize"></a>QHeader::adjustHeaderSize () </h3> <p> Adjusts the size of the sections to fit the size of the header as completely as possible. Only sections for which <a href="#isStretchEnabled">isStretchEnabled</a>() is TRUE will be resized. <p> <h3 class=fn>int <a name="cellAt"></a>QHeader::cellAt ( int pos ) const </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> Use <a href="#sectionAt">sectionAt</a>() instead. <p> Returns the index at which the section is displayed, which contains <em>pos</em> in widget coordinates, or -1 if <em>pos</em> is outside the header sections. <h3 class=fn>int <a name="cellPos"></a>QHeader::cellPos ( int i ) const </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> Use <a href="#sectionPos">sectionPos</a>() instead. <p> Returns the position in pixels of the section that is displayed at the index <em>i</em>. The position is measured from the start of the header. <h3 class=fn>int <a name="cellSize"></a>QHeader::cellSize ( int i ) const </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> Use <a href="#sectionSize">sectionSize</a>() instead. <p> Returns the size in pixels of the section that is displayed at the index <em>i</em>. <h3 class=fn>void <a name="clicked"></a>QHeader::clicked ( int section )<tt> [signal]</tt> </h3> <p> If <a href="#isClickEnabled">isClickEnabled</a>() is TRUE, this signal is emitted when the user clicks section <em>section</em>. <p> <p>See also <a href="#pressed">pressed</a>() and <a href="#released">released</a>(). <h3 class=fn>int <a name="count"></a>QHeader::count () const </h3><p>Returns the number of sections in the header. See the <a href="qheader.html#count-prop">"count"</a> property for details. <h3 class=fn>int <a name="headerWidth"></a>QHeader::headerWidth () const </h3> Returns the total width of all the header columns. <h3 class=fn><a href="qiconset.html">QIconSet</a> * <a name="iconSet"></a>QHeader::iconSet ( int section ) const </h3> Returns the icon set for section <em>section</em>. If the section does not exist, 0 is returned. <h3 class=fn>void <a name="indexChange"></a>QHeader::indexChange ( int section, int fromIndex, int toIndex )<tt> [signal]</tt> </h3> <p> This signal is emitted when the user moves section <em>section</em> from index position <em>fromIndex</em>, to index position <em>toIndex</em>. <h3 class=fn>bool <a name="isClickEnabled"></a>QHeader::isClickEnabled ( int section = -1 ) const </h3> Returns TRUE if section <em>section</em> is clickable; otherwise returns FALSE. <p> If <em>section</em> is out of range (negative or larger than <a href="#count">count</a>() - 1), TRUE is returned if all sections are clickable; otherwise returns FALSE. <p> <p>See also <a href="#setClickEnabled">setClickEnabled</a>(). <h3 class=fn>bool <a name="isMovingEnabled"></a>QHeader::isMovingEnabled () const </h3><p>Returns TRUE if the header sections can be moved; otherwise returns FALSE. See the <a href="qheader.html#moving-prop">"moving"</a> property for details. <h3 class=fn>bool <a name="isResizeEnabled"></a>QHeader::isResizeEnabled ( int section = -1 ) const </h3> Returns TRUE if section <em>section</em> is resizeable; otherwise returns FALSE. <p> If <em>section</em> is -1 then this function applies to all sections, i.e. TRUE is returned if all sections are resizeable; otherwise returns FALSE. <p> <p>See also <a href="#setResizeEnabled">setResizeEnabled</a>(). <h3 class=fn>bool <a name="isStretchEnabled"></a>QHeader::isStretchEnabled () const </h3><p>Returns TRUE if the header sections always take up the full width (or height) of the header; otherwise returns FALSE. See the <a href="qheader.html#stretching-prop">"stretching"</a> property for details. <h3 class=fn>bool <a name="isStretchEnabled-2"></a>QHeader::isStretchEnabled ( int section ) const </h3> Returns TRUE if section <em>section</em> will resize to take up the full width (or height) of the header; otherwise returns FALSE. If at least one section has stretch enabled the sections will always take up the full width of the header. <p> <p>See also <a href="#setStretchEnabled">setStretchEnabled</a>(). <h3 class=fn><a href="qstring.html">QString</a> <a name="label"></a>QHeader::label ( int section ) const </h3> Returns the text for section <em>section</em>. If the section does not exist, a null string is returned. <h3 class=fn>int <a name="mapToActual"></a>QHeader::mapToActual ( int l ) const </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> Use <a href="#mapToIndex">mapToIndex</a>() instead. <p> Translates from logical index <em>l</em> to actual index (index at which the section <em>l</em> is displayed) . Returns -1 if <em>l</em> is outside the legal range. <p> <p>See also <a href="#mapToLogical">mapToLogical</a>(). <h3 class=fn>int <a name="mapToIndex"></a>QHeader::mapToIndex ( int section ) const </h3> Returns the index at which the section <em>section</em> is currently displayed. <p> For more explanation see the <a href="#mapexample">mapTo example</a>. <h3 class=fn>int <a name="mapToLogical"></a>QHeader::mapToLogical ( int a ) const </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> Use <a href="#mapToSection">mapToSection</a>() instead. <p> Translates from actual index <em>a</em> (index at which the section is displayed) to logical index of the section. Returns -1 if <em>a</em> is outside the legal range. <p> <p>See also <a href="#mapToActual">mapToActual</a>(). <h3 class=fn>int <a name="mapToSection"></a>QHeader::mapToSection ( int index ) const </h3> Returns the section that is displayed at index position <em>index</em>. <p> For more explanation see the <a href="#mapexample">mapTo example</a>. <h3 class=fn>void <a name="moveCell"></a>QHeader::moveCell ( int fromIdx, int toIdx )<tt> [virtual]</tt> </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> Use <a href="#moveSection">moveSection</a>() instead. <p> Moves the section that is currently displayed at index <em>fromIdx</em> to index <em>toIdx</em>. <h3 class=fn>void <a name="moveSection"></a>QHeader::moveSection ( int section, int toIndex ) </h3> Moves section <em>section</em> to index position <em>toIndex</em>. <h3 class=fn>void <a name="moved"></a>QHeader::moved ( int fromIndex, int toIndex )<tt> [signal]</tt> </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> Use <a href="#indexChange">indexChange</a>() instead. <p> This signal is emitted when the user has moved the section which is displayed at the index <em>fromIndex</em> to the index <em>toIndex</em>. <h3 class=fn>int <a name="offset"></a>QHeader::offset () const </h3><p>Returns the header's leftmost (or topmost) visible pixel. See the <a href="qheader.html#offset-prop">"offset"</a> property for details. <h3 class=fn><a href="qt.html#Orientation-enum">Orientation</a> <a name="orientation"></a>QHeader::orientation () const </h3><p>Returns the header's physical orientation. See the <a href="qheader.html#orientation-prop">"orientation"</a> property for details. <h3 class=fn>void <a name="paintSection"></a>QHeader::paintSection ( <a href="qpainter.html">QPainter</a> * p, int index, const <a href="qrect.html">QRect</a> & fr )<tt> [virtual protected]</tt> </h3> Paints the section at position <em>index</em>, inside rectangle <em>fr</em> (which uses widget coordinates) using painter <em>p</em>. <p> Calls <a href="#paintSectionLabel">paintSectionLabel</a>(). <h3 class=fn>void <a name="paintSectionLabel"></a>QHeader::paintSectionLabel ( <a href="qpainter.html">QPainter</a> * p, int index, const <a href="qrect.html">QRect</a> & fr )<tt> [virtual protected]</tt> </h3> Paints the label of the section at position <em>index</em>, inside rectangle <em>fr</em> (which uses widget coordinates) using painter <em>p</em>. <p> Called by <a href="#paintSection">paintSection</a>() <h3 class=fn>void <a name="pressed"></a>QHeader::pressed ( int section )<tt> [signal]</tt> </h3> <p> This signal is emitted when the user presses section <em>section</em> down. <p> <p>See also <a href="#released">released</a>(). <h3 class=fn>void <a name="released"></a>QHeader::released ( int section )<tt> [signal]</tt> </h3> <p> This signal is emitted when section <em>section</em> is released. <p> <p>See also <a href="#pressed">pressed</a>(). <h3 class=fn>void <a name="removeLabel"></a>QHeader::removeLabel ( int section ) </h3> Removes section <em>section</em>. If the section does not exist, nothing happens. <h3 class=fn>void <a name="resizeSection"></a>QHeader::resizeSection ( int section, int s ) </h3> Resizes section <em>section</em> to <em>s</em> pixels wide (or high). <h3 class=fn><a href="qrect.html">QRect</a> <a name="sRect"></a>QHeader::sRect ( int index )<tt> [protected]</tt> </h3> Returns the rectangle covered by the section at index <em>index</em>. <h3 class=fn>int <a name="sectionAt"></a>QHeader::sectionAt ( int pos ) const </h3> Returns the index which contains the position <em>pos</em> given in pixels. <p> <p>See also <a href="#offset-prop">offset</a>. <h3 class=fn>void <a name="sectionClicked"></a>QHeader::sectionClicked ( int index )<tt> [signal]</tt> </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> Use <a href="#clicked">clicked</a>() instead. <p> This signal is emitted when a part of the header is clicked. <em>index</em> is the index at which the section is displayed. <p> In a list view this signal would typically be connected to a slot that sorts the specified column (or row). <h3 class=fn>int <a name="sectionPos"></a>QHeader::sectionPos ( int section ) const </h3> Returns the position (in pixels) at which the <em>section</em> starts. <p> <p>See also <a href="#offset-prop">offset</a>. <h3 class=fn><a href="qrect.html">QRect</a> <a name="sectionRect"></a>QHeader::sectionRect ( int section ) const </h3> Returns the rectangle covered by section <em>section</em>. <h3 class=fn>int <a name="sectionSize"></a>QHeader::sectionSize ( int section ) const </h3> Returns the width (or height) of the <em>section</em> in pixels. <h3 class=fn>void <a name="setCellSize"></a>QHeader::setCellSize ( int section, int s )<tt> [virtual]</tt> </h3> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code. <p> Use <a href="#resizeSection">resizeSection</a>() instead. <p> Sets the size of the section <em>section</em> to <em>s</em> pixels. <p> <b>Warning:</b> does not repaint or send out signals <h3 class=fn>void <a name="setClickEnabled"></a>QHeader::setClickEnabled ( bool enable, int section = -1 )<tt> [virtual]</tt> </h3> If <em>enable</em> is TRUE, any clicks on section <em>section</em> will result in <a href="#clicked">clicked</a>() signals being emitted; otherwise the section will ignore clicks. <p> If <em>section</em> is -1 (the default) then the <em>enable</em> value is set for all existing sections and will be applied to any new sections that are added. <p> <p>See also <a href="#moving-prop">moving</a> and <a href="#setResizeEnabled">setResizeEnabled</a>(). <h3 class=fn>void <a name="setLabel"></a>QHeader::setLabel ( int section, const <a href="qstring.html">QString</a> & s, int size = -1 )<tt> [virtual]</tt> </h3> Sets the text of section <em>section</em> to <em>s</em>. The section's width is set to <em>size</em> if <em>size</em> >= 0; otherwise it is left unchanged. Any icon set that has been set for this section remains unchanged. <p> If the section does not exist, nothing happens. <p>Example: <a href="small-table-example-example.html#x2469">table/small-table-demo/main.cpp</a>. <h3 class=fn>void <a name="setLabel-2"></a>QHeader::setLabel ( int section, const <a href="qiconset.html">QIconSet</a> & iconset, const <a href="qstring.html">QString</a> & s, int size = -1 )<tt> [virtual]</tt> </h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function. <p> Sets the icon for section <em>section</em> to <em>iconset</em> and the text to <em>s</em>. The section's width is set to <em>size</em> if <em>size</em> >= 0; otherwise it is left unchanged. <p> If the section does not exist, nothing happens. <h3 class=fn>void <a name="setMovingEnabled"></a>QHeader::setMovingEnabled ( bool )<tt> [virtual]</tt> </h3><p>Sets whether the header sections can be moved. See the <a href="qheader.html#moving-prop">"moving"</a> property for details. <h3 class=fn>void <a name="setOffset"></a>QHeader::setOffset ( int pos )<tt> [virtual slot]</tt> </h3><p>Sets the header's leftmost (or topmost) visible pixel to <em>pos</em>. See the <a href="qheader.html#offset-prop">"offset"</a> property for details. <h3 class=fn>void <a name="setOrientation"></a>QHeader::setOrientation ( <a href="qt.html#Orientation-enum">Orientation</a> )<tt> [virtual]</tt> </h3><p>Sets the header's physical orientation. See the <a href="qheader.html#orientation-prop">"orientation"</a> property for details. <h3 class=fn>void <a name="setResizeEnabled"></a>QHeader::setResizeEnabled ( bool enable, int section = -1 )<tt> [virtual]</tt> </h3> If <em>enable</em> is TRUE the user may resize section <em>section</em>; otherwise the section may not be manually resized. <p> If <em>section</em> is negative (the default) then the <em>enable</em> value is set for all existing sections and will be applied to any new sections that are added. Example: <pre> // Allow resizing of all current and future sections header->setResizeEnabled(TRUE); // Disable resizing of section 3, (the fourth section added) header->setResizeEnabled(FALSE, 3); </pre> <p> If the user resizes a section, a <a href="#sizeChange">sizeChange</a>() signal is emitted. <p> <p>See also <a href="#moving-prop">moving</a>, <a href="#setClickEnabled">setClickEnabled</a>() and <a href="#tracking-prop">tracking</a>. <h3 class=fn>void <a name="setSortIndicator"></a>QHeader::setSortIndicator ( int section, bool increasing = TRUE ) </h3> Because the QHeader is often used together with table or list widgets, QHeader can indicate a sort order. This is achieved by displaying an arrow at the right edge of a section. <p> If <em>increasing</em> is TRUE (the default) the arrow will point downwards; otherwise it will point upwards. <p> Only one section can show a sort indicator at any one time. If you don't want any section to show a sort indicator pass a <em>section</em> number of -1. <p> <h3 class=fn>void <a name="setStretchEnabled"></a>QHeader::setStretchEnabled ( bool b, int section )<tt> [virtual]</tt> </h3> If <em>b</em> is TRUE, section <em>section</em> will be resized when the header is resized, so that the sections take up the full width (or height for vertical headers) of the header; otherwise section <em>section</em> will be set to be unstretchable and will not resize when the header is resized. <p> If <em>section</em> is -1, and if <em>b</em> is TRUE, then all sections will be resized equally when the header is resized so that they take up the full width (or height for vertical headers) of the header; otherwise all the sections will be set to be unstretchable and will not resize when the header is resized. <p> <p>See also <a href="#adjustHeaderSize">adjustHeaderSize</a>(). <h3 class=fn>void <a name="setStretchEnabled-2"></a>QHeader::setStretchEnabled ( bool b ) </h3><p>Sets whether the header sections always take up the full width (or height) of the header to <em>b</em>. See the <a href="qheader.html#stretching-prop">"stretching"</a> property for details. <h3 class=fn>void <a name="setTracking"></a>QHeader::setTracking ( bool enable )<tt> [virtual]</tt> </h3><p>Sets whether the <a href="#sizeChange">sizeChange</a>() signal is emitted continuously to <em>enable</em>. See the <a href="qheader.html#tracking-prop">"tracking"</a> property for details. <h3 class=fn>void <a name="sizeChange"></a>QHeader::sizeChange ( int section, int oldSize, int newSize )<tt> [signal]</tt> </h3> <p> This signal is emitted when the user has changed the size of a <em>section</em> from <em>oldSize</em> to <em>newSize</em>. This signal is typically connected to a slot that repaints the table or list that contains the header. <h3 class=fn>bool <a name="tracking"></a>QHeader::tracking () const </h3><p>Returns TRUE if the <a href="#sizeChange">sizeChange</a>() signal is emitted continuously; otherwise returns FALSE. See the <a href="qheader.html#tracking-prop">"tracking"</a> property for details. <hr><h2>Property Documentation</h2> <h3 class=fn>int <a name="count-prop"></a>count</h3> <p>This property holds the number of sections in the header. <p> <p>Get this property's value with <a href="#count">count</a>(). <h3 class=fn>bool <a name="moving-prop"></a>moving</h3> <p>This property holds whether the header sections can be moved. <p>If this property is TRUE the user may move sections. If the user moves a section the <a href="#indexChange">indexChange</a>() signal is emitted. <p> <p>See also <a href="#setClickEnabled">setClickEnabled</a>() and <a href="#setResizeEnabled">setResizeEnabled</a>(). <p>Set this property's value with <a href="#setMovingEnabled">setMovingEnabled</a>() and get this property's value with <a href="#isMovingEnabled">isMovingEnabled</a>(). <h3 class=fn>int <a name="offset-prop"></a>offset</h3> <p>This property holds the header's leftmost (or topmost) visible pixel. <p>Setting this property will scroll the header so that <em>offset</em> becomes the leftmost (or topmost for vertical headers) visible pixel. <p>Set this property's value with <a href="#setOffset">setOffset</a>() and get this property's value with <a href="#offset">offset</a>(). <h3 class=fn><a href="qt.html#Orientation-enum">Orientation</a> <a name="orientation-prop"></a>orientation</h3> <p>This property holds the header's physical orientation. <p>The orientation is either QHeader::Vertical or QHeader::Horizontal (the default). <p> Call <a href="#setOrientation">setOrientation</a>() before adding labels if you don't provide a size parameter otherwise the sizes will be incorrect. <p>Set this property's value with <a href="#setOrientation">setOrientation</a>() and get this property's value with <a href="#orientation">orientation</a>(). <h3 class=fn>bool <a name="stretching-prop"></a>stretching</h3> <p>This property holds whether the header sections always take up the full width (or height) of the header. <p> <p>Set this property's value with <a href="#setStretchEnabled">setStretchEnabled</a>() and get this property's value with <a href="#isStretchEnabled">isStretchEnabled</a>(). <h3 class=fn>bool <a name="tracking-prop"></a>tracking</h3> <p>This property holds whether the <a href="#sizeChange">sizeChange</a>() signal is emitted continuously. <p>If tracking is on, the sizeChange() signal is emitted continuously while the mouse is moved (i.e. when the header is resized), otherwise it is only emitted when the mouse button is released at the end of resizing. <p> Tracking defaults to FALSE. <p>Set this property's value with <a href="#setTracking">setTracking</a>() and get this property's value with <a href="#tracking">tracking</a>(). <!-- eof --> <hr><p> This file is part of the <a href="index.html">Qt toolkit</a>. Copyright © 1995-2001 <a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center> <table width=100% cellspacing=0 border=0><tr> <td>Copyright © 2001 <a href="http://www.trolltech.com">Trolltech</a><td><a href="http://www.trolltech.com/trademarks.html">Trademarks</a> <td align=right><div align=right>Qt version 3.0.2</div> </table></div></address></body> </html>