You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
qt3/doc/html/qheader.html

608 lines
37 KiB

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qheader.cpp:135 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>QHeader Class</title>
<style type="text/css"><!--
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&nbsp;Classes</font></a>
| <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
| <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
| <a href="groups.html">
<font color="#004faf">Grouped&nbsp;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 &lt;<a href="qheader-h.html">qheader.h</a>&gt;</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 class=fn><a href="#QHeader"><b>QHeader</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#QHeader-2"><b>QHeader</b></a> ( int&nbsp;n, QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
<li class=fn><a href="#~QHeader"><b>~QHeader</b></a> ()</li>
<li class=fn>int <a href="#addLabel"><b>addLabel</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s, int&nbsp;size = -1 )</li>
<li class=fn>int <a href="#addLabel-2"><b>addLabel</b></a> ( const&nbsp;QIconSet&nbsp;&amp;&nbsp;iconset, const&nbsp;QString&nbsp;&amp;&nbsp;s, int&nbsp;size = -1 )</li>
<li class=fn>void <a href="#removeLabel"><b>removeLabel</b></a> ( int&nbsp;section )</li>
<li class=fn>virtual void <a href="#setLabel"><b>setLabel</b></a> ( int&nbsp;section, const&nbsp;QString&nbsp;&amp;&nbsp;s, int&nbsp;size = -1 )</li>
<li class=fn>virtual void <a href="#setLabel-2"><b>setLabel</b></a> ( int&nbsp;section, const&nbsp;QIconSet&nbsp;&amp;&nbsp;iconset, const&nbsp;QString&nbsp;&amp;&nbsp;s, int&nbsp;size = -1 )</li>
<li class=fn>QString <a href="#label"><b>label</b></a> ( int&nbsp;section ) const</li>
<li class=fn>QIconSet * <a href="#iconSet"><b>iconSet</b></a> ( int&nbsp;section ) const</li>
<li class=fn>virtual void <a href="#setOrientation"><b>setOrientation</b></a> ( Orientation )</li>
<li class=fn>Orientation <a href="#orientation"><b>orientation</b></a> () const</li>
<li class=fn>virtual void <a href="#setTracking"><b>setTracking</b></a> ( bool&nbsp;enable )</li>
<li class=fn>bool <a href="#tracking"><b>tracking</b></a> () const</li>
<li class=fn>virtual void <a href="#setClickEnabled"><b>setClickEnabled</b></a> ( bool&nbsp;enable, int&nbsp;section = -1 )</li>
<li class=fn>virtual void <a href="#setResizeEnabled"><b>setResizeEnabled</b></a> ( bool&nbsp;enable, int&nbsp;section = -1 )</li>
<li class=fn>virtual void <a href="#setMovingEnabled"><b>setMovingEnabled</b></a> ( bool )</li>
<li class=fn>virtual void <a href="#setStretchEnabled"><b>setStretchEnabled</b></a> ( bool&nbsp;b, int&nbsp;section )</li>
<li class=fn>void <a href="#setStretchEnabled-2"><b>setStretchEnabled</b></a> ( bool&nbsp;b )</li>
<li class=fn>bool <a href="#isClickEnabled"><b>isClickEnabled</b></a> ( int&nbsp;section = -1 ) const</li>
<li class=fn>bool <a href="#isResizeEnabled"><b>isResizeEnabled</b></a> ( int&nbsp;section = -1 ) const</li>
<li class=fn>bool <a href="#isMovingEnabled"><b>isMovingEnabled</b></a> () const</li>
<li class=fn>bool <a href="#isStretchEnabled"><b>isStretchEnabled</b></a> () const</li>
<li class=fn>bool <a href="#isStretchEnabled-2"><b>isStretchEnabled</b></a> ( int&nbsp;section ) const</li>
<li class=fn>void <a href="#resizeSection"><b>resizeSection</b></a> ( int&nbsp;section, int&nbsp;s )</li>
<li class=fn>int <a href="#sectionSize"><b>sectionSize</b></a> ( int&nbsp;section ) const</li>
<li class=fn>int <a href="#sectionPos"><b>sectionPos</b></a> ( int&nbsp;section ) const</li>
<li class=fn>int <a href="#sectionAt"><b>sectionAt</b></a> ( int&nbsp;pos ) const</li>
<li class=fn>int <a href="#count"><b>count</b></a> () const</li>
<li class=fn>int <a href="#headerWidth"><b>headerWidth</b></a> () const</li>
<li class=fn>QRect <a href="#sectionRect"><b>sectionRect</b></a> ( int&nbsp;section ) const</li>
<li class=fn>virtual void setCellSize ( int&nbsp;section, int&nbsp;s ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>int cellSize ( int&nbsp;i ) const &nbsp;<em>(obsolete)</em></li>
<li class=fn>int cellPos ( int&nbsp;i ) const &nbsp;<em>(obsolete)</em></li>
<li class=fn>int cellAt ( int&nbsp;pos ) const &nbsp;<em>(obsolete)</em></li>
<li class=fn>int <a href="#offset"><b>offset</b></a> () const</li>
<li class=fn>int <a href="#mapToSection"><b>mapToSection</b></a> ( int&nbsp;index ) const</li>
<li class=fn>int <a href="#mapToIndex"><b>mapToIndex</b></a> ( int&nbsp;section ) const</li>
<li class=fn>int mapToLogical ( int&nbsp;a ) const &nbsp;<em>(obsolete)</em></li>
<li class=fn>int mapToActual ( int&nbsp;l ) const &nbsp;<em>(obsolete)</em></li>
<li class=fn>void <a href="#moveSection"><b>moveSection</b></a> ( int&nbsp;section, int&nbsp;toIndex )</li>
<li class=fn>virtual void moveCell ( int&nbsp;fromIdx, int&nbsp;toIdx ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>void setSortIndicator ( int&nbsp;section, bool&nbsp;ascending = TRUE ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>void <a href="#setSortIndicator"><b>setSortIndicator</b></a> ( int&nbsp;section, SortOrder&nbsp;order )</li>
<li class=fn>int <a href="#sortIndicatorSection"><b>sortIndicatorSection</b></a> () const</li>
<li class=fn>SortOrder <a href="#sortIndicatorOrder"><b>sortIndicatorOrder</b></a> () const</li>
<li class=fn>void <a href="#adjustHeaderSize"><b>adjustHeaderSize</b></a> ()</li>
</ul>
<h2>Public Slots</h2>
<ul>
<li class=fn>virtual void <a href="#setOffset"><b>setOffset</b></a> ( int&nbsp;pos )</li>
</ul>
<h2>Signals</h2>
<ul>
<li class=fn>void <a href="#clicked"><b>clicked</b></a> ( int&nbsp;section )</li>
<li class=fn>void <a href="#pressed"><b>pressed</b></a> ( int&nbsp;section )</li>
<li class=fn>void <a href="#released"><b>released</b></a> ( int&nbsp;section )</li>
<li class=fn>void <a href="#sizeChange"><b>sizeChange</b></a> ( int&nbsp;section, int&nbsp;oldSize, int&nbsp;newSize )</li>
<li class=fn>void <a href="#indexChange"><b>indexChange</b></a> ( int&nbsp;section, int&nbsp;fromIndex, int&nbsp;toIndex )</li>
<li class=fn>void sectionClicked ( int&nbsp;index ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>void moved ( int&nbsp;fromIndex, int&nbsp;toIndex ) &nbsp;<em>(obsolete)</em></li>
<li class=fn>void <a href="#sectionHandleDoubleClicked"><b>sectionHandleDoubleClicked</b></a> ( int&nbsp;section )</li>
</ul>
<h2>Properties</h2>
<ul>
<li class=fn>int <a href="#count-prop"><b>count</b></a>&nbsp;- the number of sections in the header &nbsp;<em>(read only)</em></li>
<li class=fn>bool <a href="#moving-prop"><b>moving</b></a>&nbsp;- whether the header sections can be moved</li>
<li class=fn>int <a href="#offset-prop"><b>offset</b></a>&nbsp;- the header's left-most (or top-most) visible pixel</li>
<li class=fn>Orientation <a href="#orientation-prop"><b>orientation</b></a>&nbsp;- the header's orientation</li>
<li class=fn>bool <a href="#stretching-prop"><b>stretching</b></a>&nbsp;- whether the header sections always take up the full width (or height) of the header</li>
<li class=fn>bool <a href="#tracking-prop"><b>tracking</b></a>&nbsp;- whether the sizeChange() signal is emitted continuously</li>
</ul>
<h2>Protected Members</h2>
<ul>
<li class=fn>QRect <a href="#sRect"><b>sRect</b></a> ( int&nbsp;index )</li>
<li class=fn>virtual void <a href="#paintSection"><b>paintSection</b></a> ( QPainter&nbsp;*&nbsp;p, int&nbsp;index, const&nbsp;QRect&nbsp;&amp;&nbsp;fr )</li>
<li class=fn>virtual void <a href="#paintSectionLabel"><b>paintSectionLabel</b></a> ( QPainter&nbsp;*&nbsp;p, int&nbsp;index, const&nbsp;QRect&nbsp;&amp;&nbsp;fr )</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>
<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 can
display a text label and an <a href="qiconset.html">iconset</a>. A sort
indicator (an arrow) can 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 default)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>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a horizontal header called <em>name</em>, with parent <em>parent</em>.
<h3 class=fn><a name="QHeader-2"></a>QHeader::QHeader ( int&nbsp;n, <a href="qwidget.html">QWidget</a>&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )
</h3>
Constructs a horizontal header called <em>name</em>, with <em>n</em> sections
and parent <em>parent</em>.
<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&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s, int&nbsp;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> &lt; 0, an appropriate size for the
text <em>s</em> is chosen.
<h3 class=fn>int <a name="addLabel-2"></a>QHeader::addLabel ( const&nbsp;<a href="qiconset.html">QIconSet</a>&nbsp;&amp;&nbsp;iconset, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s, int&nbsp;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.
<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.
<h3 class=fn>int <a name="cellAt"></a>QHeader::cellAt ( int&nbsp;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&nbsp;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&nbsp;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&nbsp;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>&nbsp;* <a name="iconSet"></a>QHeader::iconSet ( int&nbsp;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&nbsp;section, int&nbsp;fromIndex, int&nbsp;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&nbsp;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): returns TRUE 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&nbsp;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. returns TRUE 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&nbsp;section ) const
</h3>
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> 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&nbsp;section ) const
</h3>
Returns the text for section <em>section</em>. If the section does not
exist, a <a href="qstring.html#QString-null">QString::null</a> is returned.
<p>Example: <a href="helpsystem-example.html#x2674">helpsystem/tooltip.cpp</a>.
<h3 class=fn>int <a name="mapToActual"></a>QHeader::mapToActual ( int&nbsp;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&nbsp;section ) const
</h3>
Returns the index position corresponding to the specified <em>section</em> number.
<p> <b>Warning:</b> If <a href="qtable.html">QTable</a> is used to move header sections as a result of user
interaction, the mapping exposed by this function will not reflect the
order of the headers in the table; i.e., QTable does not call <a href="#moveSection">moveSection</a>()
to move sections but handles move operations internally.
<p> <p>See also <a href="#mapToSection">mapToSection</a>().
<h3 class=fn>int <a name="mapToLogical"></a>QHeader::mapToLogical ( int&nbsp;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&nbsp;index ) const
</h3>
Returns the number of the section that corresponds to the specified <em>index</em>.
<p> <b>Warning:</b> If <a href="qtable.html">QTable</a> is used to move header sections as a result of user
interaction, the mapping exposed by this function will not reflect the
order of the headers in the table; i.e., QTable does not call <a href="#moveSection">moveSection</a>()
to move sections but handles move operations internally.
<p> <p>See also <a href="#mapToIndex">mapToIndex</a>().
<h3 class=fn>void <a name="moveCell"></a>QHeader::moveCell ( int&nbsp;fromIdx, int&nbsp;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&nbsp;section, int&nbsp;toIndex )
</h3>
Moves section <em>section</em> to index position <em>toIndex</em>.
<h3 class=fn>void <a name="moved"></a>QHeader::moved ( int&nbsp;fromIndex, int&nbsp;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 left-most (or top-most) 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 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>&nbsp;*&nbsp;p, int&nbsp;index, const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;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>&nbsp;*&nbsp;p, int&nbsp;index, const&nbsp;<a href="qrect.html">QRect</a>&nbsp;&amp;&nbsp;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&nbsp;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&nbsp;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&nbsp;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&nbsp;section, int&nbsp;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&nbsp;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&nbsp;pos ) const
</h3>
Returns the index of the section which contains the position <em>pos</em> given in pixels from the left (or top).
<p> <p>See also <a href="#offset-prop">offset</a>.
<p>Example: <a href="helpsystem-example.html#x2677">helpsystem/tooltip.cpp</a>.
<h3 class=fn>void <a name="sectionClicked"></a>QHeader::sectionClicked ( int&nbsp;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>void <a name="sectionHandleDoubleClicked"></a>QHeader::sectionHandleDoubleClicked ( int&nbsp;section )<tt> [signal]</tt>
</h3>
<p> This signal is emitted when the user doubleclicks on the edge
(handle) of section <em>section</em>.
<h3 class=fn>int <a name="sectionPos"></a>QHeader::sectionPos ( int&nbsp;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&nbsp;section ) const
</h3>
Returns the rectangle covered by section <em>section</em>.
<p>Example: <a href="helpsystem-example.html#x2678">helpsystem/tooltip.cpp</a>.
<h3 class=fn>int <a name="sectionSize"></a>QHeader::sectionSize ( int&nbsp;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&nbsp;section, int&nbsp;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&nbsp;enable, int&nbsp;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&nbsp;section, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s, int&nbsp;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> &gt;= 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>Examples: <a href="tutorial2-08.html#x2605">chart/setdataform.cpp</a> and <a href="small-table-example-example.html#x2798">table/small-table-demo/main.cpp</a>.
<h3 class=fn>void <a name="setLabel-2"></a>QHeader::setLabel ( int&nbsp;section, const&nbsp;<a href="qiconset.html">QIconSet</a>&nbsp;&amp;&nbsp;iconset, const&nbsp;<a href="qstring.html">QString</a>&nbsp;&amp;&nbsp;s, int&nbsp;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> &gt;= 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&nbsp;pos )<tt> [virtual slot]</tt>
</h3><p>Sets the header's left-most (or top-most) 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 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&nbsp;enable, int&nbsp;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-&gt;setResizeEnabled(TRUE);
// Disable resizing of section 3, (the fourth section added)
header-&gt;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&nbsp;section, <a href="qt.html#SortOrder-enum">SortOrder</a>&nbsp;order )
</h3>
<p> Sets a sort indicator onto the specified <em>section</em>. The indicator's
<em>order</em> is either Ascending or Descending.
<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> <p>See also <a href="#sortIndicatorSection">sortIndicatorSection</a>() and <a href="#sortIndicatorOrder">sortIndicatorOrder</a>().
<h3 class=fn>void <a name="setSortIndicator-2"></a>QHeader::setSortIndicator ( int&nbsp;section, bool&nbsp;ascending = TRUE )
</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
<p> <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 the other overload instead.
<h3 class=fn>void <a name="setStretchEnabled"></a>QHeader::setStretchEnabled ( bool&nbsp;b, int&nbsp;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&nbsp;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&nbsp;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&nbsp;section, int&nbsp;oldSize, int&nbsp;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><a href="qt.html#SortOrder-enum">SortOrder</a> <a name="sortIndicatorOrder"></a>QHeader::sortIndicatorOrder () const
</h3>
Returns the implied sort order of the QHeaders sort indicator.
<p> <p>See also <a href="#setSortIndicator">setSortIndicator</a>() and <a href="#sortIndicatorSection">sortIndicatorSection</a>().
<h3 class=fn>int <a name="sortIndicatorSection"></a>QHeader::sortIndicatorSection () const
</h3>
Returns the section showing the sort indicator or -1 if there is no sort indicator.
<p> <p>See also <a href="#setSortIndicator">setSortIndicator</a>() and <a href="#sortIndicatorOrder">sortIndicatorOrder</a>().
<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 default) the user can 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 left-most (or top-most) visible pixel.
<p>Setting this property will scroll the header so that <em>offset</em>
becomes the left-most (or top-most 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 orientation.
<p>The orientation is either <a href="qt.html#Orientation-enum">Vertical</a> or <a href="qt.html#Orientation-enum">Horizontal</a> (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 &copy; 1995-2007
<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 &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>Qt 3.3.8</div>
</table></div></address></body>
</html>