source: trunk/doc/html/qheader.html@ 190

Last change on this file since 190 was 190, checked in by rudi, 14 years ago

reference documentation added

File size: 37.8 KB
Line 
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/src/widgets/qheader.cpp:135 -->
3<html>
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
6<title>QHeader Class</title>
7<style type="text/css"><!--
8fn { margin-left: 1cm; text-indent: -1cm; }
9a:link { color: #004faf; text-decoration: none }
10a:visited { color: #672967; text-decoration: none }
11body { background: #ffffff; color: black; }
12--></style>
13</head>
14<body>
15
16<table border="0" cellpadding="0" cellspacing="0" width="100%">
17<tr bgcolor="#E5E5E5">
18<td valign=center>
19 <a href="index.html">
20<font color="#004faf">Home</font></a>
21 | <a href="classes.html">
22<font color="#004faf">All&nbsp;Classes</font></a>
23 | <a href="mainclasses.html">
24<font color="#004faf">Main&nbsp;Classes</font></a>
25 | <a href="annotated.html">
26<font color="#004faf">Annotated</font></a>
27 | <a href="groups.html">
28<font color="#004faf">Grouped&nbsp;Classes</font></a>
29 | <a href="functions.html">
30<font color="#004faf">Functions</font></a>
31</td>
32<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>
33
34<p>The QHeader class provides a header row or column, e.g. for
35tables and listviews.
36<a href="#details">More...</a>
37<p><tt>#include &lt;<a href="qheader-h.html">qheader.h</a>&gt;</tt>
38<p>Inherits <a href="qwidget.html">QWidget</a>.
39<p><a href="qheader-members.html">List of all member functions.</a>
40<h2>Public Members</h2>
41<ul>
42<li class=fn><a href="#QHeader"><b>QHeader</b></a> ( QWidget&nbsp;*&nbsp;parent = 0, const&nbsp;char&nbsp;*&nbsp;name = 0 )</li>
43<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>
44<li class=fn><a href="#~QHeader"><b>~QHeader</b></a> ()</li>
45<li class=fn>int <a href="#addLabel"><b>addLabel</b></a> ( const&nbsp;QString&nbsp;&amp;&nbsp;s, int&nbsp;size = -1 )</li>
46<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>
47<li class=fn>void <a href="#removeLabel"><b>removeLabel</b></a> ( int&nbsp;section )</li>
48<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>
49<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>
50<li class=fn>QString <a href="#label"><b>label</b></a> ( int&nbsp;section ) const</li>
51<li class=fn>QIconSet * <a href="#iconSet"><b>iconSet</b></a> ( int&nbsp;section ) const</li>
52<li class=fn>virtual void <a href="#setOrientation"><b>setOrientation</b></a> ( Orientation )</li>
53<li class=fn>Orientation <a href="#orientation"><b>orientation</b></a> () const</li>
54<li class=fn>virtual void <a href="#setTracking"><b>setTracking</b></a> ( bool&nbsp;enable )</li>
55<li class=fn>bool <a href="#tracking"><b>tracking</b></a> () const</li>
56<li class=fn>virtual void <a href="#setClickEnabled"><b>setClickEnabled</b></a> ( bool&nbsp;enable, int&nbsp;section = -1 )</li>
57<li class=fn>virtual void <a href="#setResizeEnabled"><b>setResizeEnabled</b></a> ( bool&nbsp;enable, int&nbsp;section = -1 )</li>
58<li class=fn>virtual void <a href="#setMovingEnabled"><b>setMovingEnabled</b></a> ( bool )</li>
59<li class=fn>virtual void <a href="#setStretchEnabled"><b>setStretchEnabled</b></a> ( bool&nbsp;b, int&nbsp;section )</li>
60<li class=fn>void <a href="#setStretchEnabled-2"><b>setStretchEnabled</b></a> ( bool&nbsp;b )</li>
61<li class=fn>bool <a href="#isClickEnabled"><b>isClickEnabled</b></a> ( int&nbsp;section = -1 ) const</li>
62<li class=fn>bool <a href="#isResizeEnabled"><b>isResizeEnabled</b></a> ( int&nbsp;section = -1 ) const</li>
63<li class=fn>bool <a href="#isMovingEnabled"><b>isMovingEnabled</b></a> () const</li>
64<li class=fn>bool <a href="#isStretchEnabled"><b>isStretchEnabled</b></a> () const</li>
65<li class=fn>bool <a href="#isStretchEnabled-2"><b>isStretchEnabled</b></a> ( int&nbsp;section ) const</li>
66<li class=fn>void <a href="#resizeSection"><b>resizeSection</b></a> ( int&nbsp;section, int&nbsp;s )</li>
67<li class=fn>int <a href="#sectionSize"><b>sectionSize</b></a> ( int&nbsp;section ) const</li>
68<li class=fn>int <a href="#sectionPos"><b>sectionPos</b></a> ( int&nbsp;section ) const</li>
69<li class=fn>int <a href="#sectionAt"><b>sectionAt</b></a> ( int&nbsp;pos ) const</li>
70<li class=fn>int <a href="#count"><b>count</b></a> () const</li>
71<li class=fn>int <a href="#headerWidth"><b>headerWidth</b></a> () const</li>
72<li class=fn>QRect <a href="#sectionRect"><b>sectionRect</b></a> ( int&nbsp;section ) const</li>
73<li class=fn>virtual void setCellSize ( int&nbsp;section, int&nbsp;s ) &nbsp;<em>(obsolete)</em></li>
74<li class=fn>int cellSize ( int&nbsp;i ) const &nbsp;<em>(obsolete)</em></li>
75<li class=fn>int cellPos ( int&nbsp;i ) const &nbsp;<em>(obsolete)</em></li>
76<li class=fn>int cellAt ( int&nbsp;pos ) const &nbsp;<em>(obsolete)</em></li>
77<li class=fn>int <a href="#offset"><b>offset</b></a> () const</li>
78<li class=fn>int <a href="#mapToSection"><b>mapToSection</b></a> ( int&nbsp;index ) const</li>
79<li class=fn>int <a href="#mapToIndex"><b>mapToIndex</b></a> ( int&nbsp;section ) const</li>
80<li class=fn>int mapToLogical ( int&nbsp;a ) const &nbsp;<em>(obsolete)</em></li>
81<li class=fn>int mapToActual ( int&nbsp;l ) const &nbsp;<em>(obsolete)</em></li>
82<li class=fn>void <a href="#moveSection"><b>moveSection</b></a> ( int&nbsp;section, int&nbsp;toIndex )</li>
83<li class=fn>virtual void moveCell ( int&nbsp;fromIdx, int&nbsp;toIdx ) &nbsp;<em>(obsolete)</em></li>
84<li class=fn>void setSortIndicator ( int&nbsp;section, bool&nbsp;ascending = TRUE ) &nbsp;<em>(obsolete)</em></li>
85<li class=fn>void <a href="#setSortIndicator"><b>setSortIndicator</b></a> ( int&nbsp;section, SortOrder&nbsp;order )</li>
86<li class=fn>int <a href="#sortIndicatorSection"><b>sortIndicatorSection</b></a> () const</li>
87<li class=fn>SortOrder <a href="#sortIndicatorOrder"><b>sortIndicatorOrder</b></a> () const</li>
88<li class=fn>void <a href="#adjustHeaderSize"><b>adjustHeaderSize</b></a> ()</li>
89</ul>
90<h2>Public Slots</h2>
91<ul>
92<li class=fn>virtual void <a href="#setOffset"><b>setOffset</b></a> ( int&nbsp;pos )</li>
93</ul>
94<h2>Signals</h2>
95<ul>
96<li class=fn>void <a href="#clicked"><b>clicked</b></a> ( int&nbsp;section )</li>
97<li class=fn>void <a href="#pressed"><b>pressed</b></a> ( int&nbsp;section )</li>
98<li class=fn>void <a href="#released"><b>released</b></a> ( int&nbsp;section )</li>
99<li class=fn>void <a href="#sizeChange"><b>sizeChange</b></a> ( int&nbsp;section, int&nbsp;oldSize, int&nbsp;newSize )</li>
100<li class=fn>void <a href="#indexChange"><b>indexChange</b></a> ( int&nbsp;section, int&nbsp;fromIndex, int&nbsp;toIndex )</li>
101<li class=fn>void sectionClicked ( int&nbsp;index ) &nbsp;<em>(obsolete)</em></li>
102<li class=fn>void moved ( int&nbsp;fromIndex, int&nbsp;toIndex ) &nbsp;<em>(obsolete)</em></li>
103<li class=fn>void <a href="#sectionHandleDoubleClicked"><b>sectionHandleDoubleClicked</b></a> ( int&nbsp;section )</li>
104</ul>
105<h2>Properties</h2>
106<ul>
107<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>
108<li class=fn>bool <a href="#moving-prop"><b>moving</b></a>&nbsp;- whether the header sections can be moved</li>
109<li class=fn>int <a href="#offset-prop"><b>offset</b></a>&nbsp;- the header's left-most (or top-most) visible pixel</li>
110<li class=fn>Orientation <a href="#orientation-prop"><b>orientation</b></a>&nbsp;- the header's orientation</li>
111<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>
112<li class=fn>bool <a href="#tracking-prop"><b>tracking</b></a>&nbsp;- whether the sizeChange() signal is emitted continuously</li>
113</ul>
114<h2>Protected Members</h2>
115<ul>
116<li class=fn>QRect <a href="#sRect"><b>sRect</b></a> ( int&nbsp;index )</li>
117<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>
118<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>
119</ul>
120<hr><a name="details"></a><h2>Detailed Description</h2>
121
122
123The QHeader class provides a header row or column, e.g. for
124tables and listviews.
125<p>
126<p> This class provides a header, e.g. a vertical header to display
127row labels, or a horizontal header to display column labels. It is
128used by <a href="qtable.html">QTable</a> and <a href="qlistview.html">QListView</a> for example.
129<p> A header is composed of one or more <em>sections</em>, each of which can
130display a text label and an <a href="qiconset.html">iconset</a>. A sort
131indicator (an arrow) can also be displayed using
132<a href="#setSortIndicator">setSortIndicator</a>().
133<p> Sections are added with <a href="#addLabel">addLabel</a>() and removed with <a href="#removeLabel">removeLabel</a>().
134The label and iconset are set in addLabel() and can be changed
135later with <a href="#setLabel">setLabel</a>(). Use <a href="#count">count</a>() to retrieve the number of
136sections in the header.
137<p> The orientation of the header is set with <a href="#setOrientation">setOrientation</a>(). If
138<a href="#setStretchEnabled">setStretchEnabled</a>() is TRUE, the sections will expand to take up
139the full width (height for vertical headers) of the header. The
140user can resize the sections manually if <a href="#setResizeEnabled">setResizeEnabled</a>() is
141TRUE. Call <a href="#adjustHeaderSize">adjustHeaderSize</a>() to have the sections resize to
142occupy the full width (or height).
143<p> A section can be moved with <a href="#moveSection">moveSection</a>(). If <a href="#setMovingEnabled">setMovingEnabled</a>()
144is TRUE (the default)the user may drag a section from one position
145to another. If a section is moved, the index positions at which
146sections were added (with <a href="#addLabel">addLabel</a>()), may not be the same after the
147move. You don't have to worry about this in practice because the
148QHeader API works in terms of section numbers, so it doesn't matter
149where a particular section has been moved to.
150<p> If you want the current index position of a section call
151<a href="#mapToIndex">mapToIndex</a>() giving it the section number. (This is the number
152returned by the addLabel() call which created the section.) If you
153want to get the section number of a section at a particular index
154position call <a href="#mapToSection">mapToSection</a>() giving it the index number.
155<p> Here's an example to clarify mapToSection() and mapToIndex():
156<p> <center><table cellpadding="4" cellspacing="2" border="0">
157<tr bgcolor="#a2c511"> <th valign="top" colspan="4" rowspan="1"> Index positions
158<tr bgcolor="#f0f0f0"> <td valign="top">0 <td valign="top">1 <td valign="top">2 <td valign="top">3
159<tr bgcolor="#a2c511"> <th valign="top" colspan="4" rowspan="1"> Original section ordering
160<tr bgcolor="#d0d0d0"> <td valign="top">Sect 0 <td valign="top">Sect 1 <td valign="top">Sect 2 <td valign="top">Sect 3
161<tr bgcolor="#a2c511"> <th valign="top" colspan="4" rowspan="1"> Ordering after the user moves a section
162<tr bgcolor="#f0f0f0"> <td valign="top">Sect 0 <td valign="top">Sect 2 <td valign="top">Sect 3 <td valign="top">Sect 1
163</table></center>
164<p> <center><table cellpadding="4" cellspacing="2" border="0">
165<tr bgcolor="#a2c511"> <th valign="top"><em>k</em> <th valign="top">mapToSection(<em>k</em>) <th valign="top">mapToIndex(<em>k</em>)
166<tr bgcolor="#d0d0d0"> <td valign="top">0 <td valign="top">0 <td valign="top">0
167<tr bgcolor="#f0f0f0"> <td valign="top">1 <td valign="top">2 <td valign="top">3
168<tr bgcolor="#d0d0d0"> <td valign="top">2 <td valign="top">3 <td valign="top">1
169<tr bgcolor="#f0f0f0"> <td valign="top">3 <td valign="top">1 <td valign="top">2
170</table></center>
171<p> In the example above, if we wanted to find out which section is at
172index position 3 we'd call <a href="#mapToSection">mapToSection</a>(3) and get a section
173number of 1 since section 1 was moved. Similarly, if we wanted to
174know which index position section 2 occupied we'd call
175<a href="#mapToIndex">mapToIndex</a>(2) and get an index of 1.
176<p> QHeader provides the <a href="#clicked">clicked</a>(), <a href="#pressed">pressed</a>() and <a href="#released">released</a>() signals.
177If the user changes the size of a section, the <a href="#sizeChange">sizeChange</a>() signal
178is emitted. If you want to have a sizeChange() signal emitted
179continuously whilst the user is resizing (rather than just after
180the resizing is finished), use <a href="#setTracking">setTracking</a>(). If the user moves a
181section the <a href="#indexChange">indexChange</a>() signal is emitted.
182<p> <img src=qheader-m.png> <img src=qheader-w.png>
183<p> <p>See also <a href="qlistview.html">QListView</a>, <a href="qtable.html">QTable</a>, and <a href="advanced.html">Advanced Widgets</a>.
184
185<hr><h2>Member Function Documentation</h2>
186<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 )
187</h3>
188Constructs a horizontal header called <em>name</em>, with parent <em>parent</em>.
189
190<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 )
191</h3>
192Constructs a horizontal header called <em>name</em>, with <em>n</em> sections
193and parent <em>parent</em>.
194
195<h3 class=fn><a name="~QHeader"></a>QHeader::~QHeader ()
196</h3>
197Destroys the header and all its sections.
198
199<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 )
200</h3>
201Adds a new section with label text <em>s</em>. Returns the index
202position where the section was added (at the right for horizontal
203headers, at the bottom for vertical headers). The section's width
204is set to <em>size</em>. If <em>size</em> &lt; 0, an appropriate size for the
205text <em>s</em> is chosen.
206
207<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 )
208</h3>
209This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
210<p> Adds a new section with iconset <em>iconset</em> and label text <em>s</em>.
211Returns the index position where the section was added (at the
212right for horizontal headers, at the bottom for vertical headers).
213The section's width is set to <em>size</em>, unless size is negative in
214which case the size is calculated taking account of the size of
215the text.
216
217<h3 class=fn>void <a name="adjustHeaderSize"></a>QHeader::adjustHeaderSize ()
218</h3>
219
220<p> Adjusts the size of the sections to fit the size of the header as
221completely as possible. Only sections for which <a href="#isStretchEnabled">isStretchEnabled</a>()
222is TRUE will be resized.
223
224<h3 class=fn>int <a name="cellAt"></a>QHeader::cellAt ( int&nbsp;pos ) const
225</h3>
226<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
227<p> Use <a href="#sectionAt">sectionAt</a>() instead.
228<p> Returns the index at which the section is displayed, which contains
229<em>pos</em> in widget coordinates, or -1 if <em>pos</em> is outside the header
230sections.
231
232<h3 class=fn>int <a name="cellPos"></a>QHeader::cellPos ( int&nbsp;i ) const
233</h3>
234<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
235<p> Use <a href="#sectionPos">sectionPos</a>() instead.
236<p> Returns the position in pixels of the section that is displayed at the
237index <em>i</em>. The position is measured from the start of the header.
238
239<h3 class=fn>int <a name="cellSize"></a>QHeader::cellSize ( int&nbsp;i ) const
240</h3>
241<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
242<p> Use <a href="#sectionSize">sectionSize</a>() instead.
243<p> Returns the size in pixels of the section that is displayed at
244the index <em>i</em>.
245
246<h3 class=fn>void <a name="clicked"></a>QHeader::clicked ( int&nbsp;section )<tt> [signal]</tt>
247</h3>
248
249<p> If <a href="#isClickEnabled">isClickEnabled</a>() is TRUE, this signal is emitted when the user
250clicks section <em>section</em>.
251<p> <p>See also <a href="#pressed">pressed</a>() and <a href="#released">released</a>().
252
253<h3 class=fn>int <a name="count"></a>QHeader::count () const
254</h3><p>Returns the number of sections in the header.
255See the <a href="qheader.html#count-prop">"count"</a> property for details.
256<h3 class=fn>int <a name="headerWidth"></a>QHeader::headerWidth () const
257</h3>
258Returns the total width of all the header columns.
259
260<h3 class=fn><a href="qiconset.html">QIconSet</a>&nbsp;* <a name="iconSet"></a>QHeader::iconSet ( int&nbsp;section ) const
261</h3>
262Returns the icon set for section <em>section</em>. If the section does
263not exist, 0 is returned.
264
265<h3 class=fn>void <a name="indexChange"></a>QHeader::indexChange ( int&nbsp;section, int&nbsp;fromIndex, int&nbsp;toIndex )<tt> [signal]</tt>
266</h3>
267
268<p> This signal is emitted when the user moves section <em>section</em> from
269index position <em>fromIndex</em>, to index position <em>toIndex</em>.
270
271<h3 class=fn>bool <a name="isClickEnabled"></a>QHeader::isClickEnabled ( int&nbsp;section = -1 ) const
272</h3>
273Returns TRUE if section <em>section</em> is clickable; otherwise returns
274FALSE.
275<p> If <em>section</em> is out of range (negative or larger than <a href="#count">count</a>() -
2761): returns TRUE if all sections are clickable; otherwise returns
277FALSE.
278<p> <p>See also <a href="#setClickEnabled">setClickEnabled</a>().
279
280<h3 class=fn>bool <a name="isMovingEnabled"></a>QHeader::isMovingEnabled () const
281</h3><p>Returns TRUE if the header sections can be moved; otherwise returns FALSE.
282See the <a href="qheader.html#moving-prop">"moving"</a> property for details.
283<h3 class=fn>bool <a name="isResizeEnabled"></a>QHeader::isResizeEnabled ( int&nbsp;section = -1 ) const
284</h3>
285Returns TRUE if section <em>section</em> is resizeable; otherwise
286returns FALSE.
287<p> If <em>section</em> is -1 then this function applies to all sections,
288i.e. returns TRUE if all sections are resizeable; otherwise
289returns FALSE.
290<p> <p>See also <a href="#setResizeEnabled">setResizeEnabled</a>().
291
292<h3 class=fn>bool <a name="isStretchEnabled"></a>QHeader::isStretchEnabled () const
293</h3><p>Returns TRUE if the header sections always take up the full width (or height) of the header; otherwise returns FALSE.
294See the <a href="qheader.html#stretching-prop">"stretching"</a> property for details.
295<h3 class=fn>bool <a name="isStretchEnabled-2"></a>QHeader::isStretchEnabled ( int&nbsp;section ) const
296</h3>
297This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
298<p> Returns TRUE if section <em>section</em> will resize to take up the full
299width (or height) of the header; otherwise returns FALSE. If at
300least one section has stretch enabled the sections will always
301take up the full width of the header.
302<p> <p>See also <a href="#setStretchEnabled">setStretchEnabled</a>().
303
304<h3 class=fn><a href="qstring.html">QString</a> <a name="label"></a>QHeader::label ( int&nbsp;section ) const
305</h3>
306Returns the text for section <em>section</em>. If the section does not
307exist, a <a href="qstring.html#QString-null">QString::null</a> is returned.
308
309<p>Example: <a href="helpsystem-example.html#x2674">helpsystem/tooltip.cpp</a>.
310<h3 class=fn>int <a name="mapToActual"></a>QHeader::mapToActual ( int&nbsp;l ) const
311</h3>
312<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
313<p> Use <a href="#mapToIndex">mapToIndex</a>() instead.
314<p> Translates from logical index <em>l</em> to actual index (index at which the section <em>l</em> is displayed) .
315Returns -1 if <em>l</em> is outside the legal range.
316<p> <p>See also <a href="#mapToLogical">mapToLogical</a>().
317
318<h3 class=fn>int <a name="mapToIndex"></a>QHeader::mapToIndex ( int&nbsp;section ) const
319</h3>
320Returns the index position corresponding to the specified <em>section</em> number.
321<p> <b>Warning:</b> If <a href="qtable.html">QTable</a> is used to move header sections as a result of user
322interaction, the mapping exposed by this function will not reflect the
323order of the headers in the table; i.e., QTable does not call <a href="#moveSection">moveSection</a>()
324to move sections but handles move operations internally.
325<p> <p>See also <a href="#mapToSection">mapToSection</a>().
326
327<h3 class=fn>int <a name="mapToLogical"></a>QHeader::mapToLogical ( int&nbsp;a ) const
328</h3>
329<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
330<p> Use <a href="#mapToSection">mapToSection</a>() instead.
331<p> Translates from actual index <em>a</em> (index at which the section is displayed) to
332logical index of the section. Returns -1 if <em>a</em> is outside the legal range.
333<p> <p>See also <a href="#mapToActual">mapToActual</a>().
334
335<h3 class=fn>int <a name="mapToSection"></a>QHeader::mapToSection ( int&nbsp;index ) const
336</h3>
337Returns the number of the section that corresponds to the specified <em>index</em>.
338<p> <b>Warning:</b> If <a href="qtable.html">QTable</a> is used to move header sections as a result of user
339interaction, the mapping exposed by this function will not reflect the
340order of the headers in the table; i.e., QTable does not call <a href="#moveSection">moveSection</a>()
341to move sections but handles move operations internally.
342<p> <p>See also <a href="#mapToIndex">mapToIndex</a>().
343
344<h3 class=fn>void <a name="moveCell"></a>QHeader::moveCell ( int&nbsp;fromIdx, int&nbsp;toIdx )<tt> [virtual]</tt>
345</h3>
346<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
347<p> Use <a href="#moveSection">moveSection</a>() instead.
348<p> Moves the section that is currently displayed at index <em>fromIdx</em>
349to index <em>toIdx</em>.
350
351<h3 class=fn>void <a name="moveSection"></a>QHeader::moveSection ( int&nbsp;section, int&nbsp;toIndex )
352</h3>
353Moves section <em>section</em> to index position <em>toIndex</em>.
354
355<h3 class=fn>void <a name="moved"></a>QHeader::moved ( int&nbsp;fromIndex, int&nbsp;toIndex )<tt> [signal]</tt>
356</h3>
357
358<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
359<p> Use <a href="#indexChange">indexChange</a>() instead.
360<p> This signal is emitted when the user has moved the section which
361is displayed at the index <em>fromIndex</em> to the index <em>toIndex</em>.
362
363<h3 class=fn>int <a name="offset"></a>QHeader::offset () const
364</h3><p>Returns the header's left-most (or top-most) visible pixel.
365See the <a href="qheader.html#offset-prop">"offset"</a> property for details.
366<h3 class=fn><a href="qt.html#Orientation-enum">Orientation</a> <a name="orientation"></a>QHeader::orientation () const
367</h3><p>Returns the header's orientation.
368See the <a href="qheader.html#orientation-prop">"orientation"</a> property for details.
369<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>
370</h3>
371Paints the section at position <em>index</em>, inside rectangle <em>fr</em>
372(which uses widget coordinates) using painter <em>p</em>.
373<p> Calls <a href="#paintSectionLabel">paintSectionLabel</a>().
374
375<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>
376</h3>
377Paints the label of the section at position <em>index</em>, inside
378rectangle <em>fr</em> (which uses widget coordinates) using painter <em>p</em>.
379<p> Called by <a href="#paintSection">paintSection</a>()
380
381<h3 class=fn>void <a name="pressed"></a>QHeader::pressed ( int&nbsp;section )<tt> [signal]</tt>
382</h3>
383
384<p> This signal is emitted when the user presses section <em>section</em>
385down.
386<p> <p>See also <a href="#released">released</a>().
387
388<h3 class=fn>void <a name="released"></a>QHeader::released ( int&nbsp;section )<tt> [signal]</tt>
389</h3>
390
391<p> This signal is emitted when section <em>section</em> is released.
392<p> <p>See also <a href="#pressed">pressed</a>().
393
394<h3 class=fn>void <a name="removeLabel"></a>QHeader::removeLabel ( int&nbsp;section )
395</h3>
396Removes section <em>section</em>. If the section does not exist, nothing
397happens.
398
399<h3 class=fn>void <a name="resizeSection"></a>QHeader::resizeSection ( int&nbsp;section, int&nbsp;s )
400</h3>
401Resizes section <em>section</em> to <em>s</em> pixels wide (or high).
402
403<h3 class=fn><a href="qrect.html">QRect</a> <a name="sRect"></a>QHeader::sRect ( int&nbsp;index )<tt> [protected]</tt>
404</h3>
405Returns the rectangle covered by the section at index <em>index</em>.
406
407<h3 class=fn>int <a name="sectionAt"></a>QHeader::sectionAt ( int&nbsp;pos ) const
408</h3>
409Returns the index of the section which contains the position <em>pos</em> given in pixels from the left (or top).
410<p> <p>See also <a href="#offset-prop">offset</a>.
411
412<p>Example: <a href="helpsystem-example.html#x2677">helpsystem/tooltip.cpp</a>.
413<h3 class=fn>void <a name="sectionClicked"></a>QHeader::sectionClicked ( int&nbsp;index )<tt> [signal]</tt>
414</h3>
415
416<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
417<p> Use <a href="#clicked">clicked</a>() instead.
418<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.
419<p> In a list view this signal would typically be connected to a slot
420that sorts the specified column (or row).
421
422<h3 class=fn>void <a name="sectionHandleDoubleClicked"></a>QHeader::sectionHandleDoubleClicked ( int&nbsp;section )<tt> [signal]</tt>
423</h3>
424
425<p> This signal is emitted when the user doubleclicks on the edge
426(handle) of section <em>section</em>.
427
428<h3 class=fn>int <a name="sectionPos"></a>QHeader::sectionPos ( int&nbsp;section ) const
429</h3>
430Returns the position (in pixels) at which the <em>section</em> starts.
431<p> <p>See also <a href="#offset-prop">offset</a>.
432
433<h3 class=fn><a href="qrect.html">QRect</a> <a name="sectionRect"></a>QHeader::sectionRect ( int&nbsp;section ) const
434</h3>
435Returns the rectangle covered by section <em>section</em>.
436
437<p>Example: <a href="helpsystem-example.html#x2678">helpsystem/tooltip.cpp</a>.
438<h3 class=fn>int <a name="sectionSize"></a>QHeader::sectionSize ( int&nbsp;section ) const
439</h3>
440Returns the width (or height) of the <em>section</em> in pixels.
441
442<h3 class=fn>void <a name="setCellSize"></a>QHeader::setCellSize ( int&nbsp;section, int&nbsp;s )<tt> [virtual]</tt>
443</h3>
444<b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
445<p> Use <a href="#resizeSection">resizeSection</a>() instead.
446<p> Sets the size of the section <em>section</em> to <em>s</em> pixels.
447<p> <b>Warning:</b> does not repaint or send out signals
448
449<h3 class=fn>void <a name="setClickEnabled"></a>QHeader::setClickEnabled ( bool&nbsp;enable, int&nbsp;section = -1 )<tt> [virtual]</tt>
450</h3>
451If <em>enable</em> is TRUE, any clicks on section <em>section</em> will result
452in <a href="#clicked">clicked</a>() signals being emitted; otherwise the section will
453ignore clicks.
454<p> If <em>section</em> is -1 (the default) then the <em>enable</em> value is set
455for all existing sections and will be applied to any new sections
456that are added.
457<p> <p>See also <a href="#moving-prop">moving</a> and <a href="#setResizeEnabled">setResizeEnabled</a>().
458
459<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>
460</h3>
461Sets the text of section <em>section</em> to <em>s</em>. The section's width
462is set to <em>size</em> if <em>size</em> &gt;= 0; otherwise it is left
463unchanged. Any icon set that has been set for this section remains
464unchanged.
465<p> If the section does not exist, nothing happens.
466
467<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>.
468<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>
469</h3>
470This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
471<p> Sets the icon for section <em>section</em> to <em>iconset</em> and the text to
472<em>s</em>. The section's width is set to <em>size</em> if <em>size</em> &gt;= 0;
473otherwise it is left unchanged.
474<p> If the section does not exist, nothing happens.
475
476<h3 class=fn>void <a name="setMovingEnabled"></a>QHeader::setMovingEnabled ( bool )<tt> [virtual]</tt>
477</h3><p>Sets whether the header sections can be moved.
478See the <a href="qheader.html#moving-prop">"moving"</a> property for details.
479<h3 class=fn>void <a name="setOffset"></a>QHeader::setOffset ( int&nbsp;pos )<tt> [virtual slot]</tt>
480</h3><p>Sets the header's left-most (or top-most) visible pixel to <em>pos</em>.
481See the <a href="qheader.html#offset-prop">"offset"</a> property for details.
482<h3 class=fn>void <a name="setOrientation"></a>QHeader::setOrientation ( <a href="qt.html#Orientation-enum">Orientation</a> )<tt> [virtual]</tt>
483</h3><p>Sets the header's orientation.
484See the <a href="qheader.html#orientation-prop">"orientation"</a> property for details.
485<h3 class=fn>void <a name="setResizeEnabled"></a>QHeader::setResizeEnabled ( bool&nbsp;enable, int&nbsp;section = -1 )<tt> [virtual]</tt>
486</h3>
487If <em>enable</em> is TRUE the user may resize section <em>section</em>;
488otherwise the section may not be manually resized.
489<p> If <em>section</em> is negative (the default) then the <em>enable</em> value
490is set for all existing sections and will be applied to any new
491sections that are added.
492Example:
493<pre>
494 // Allow resizing of all current and future sections
495 header-&gt;setResizeEnabled(TRUE);
496 // Disable resizing of section 3, (the fourth section added)
497 header-&gt;setResizeEnabled(FALSE, 3);
498 </pre>
499
500<p> If the user resizes a section, a <a href="#sizeChange">sizeChange</a>() signal is emitted.
501<p> <p>See also <a href="#moving-prop">moving</a>, <a href="#setClickEnabled">setClickEnabled</a>(), and <a href="#tracking-prop">tracking</a>.
502
503<h3 class=fn>void <a name="setSortIndicator"></a>QHeader::setSortIndicator ( int&nbsp;section, <a href="qt.html#SortOrder-enum">SortOrder</a>&nbsp;order )
504</h3>
505
506<p> Sets a sort indicator onto the specified <em>section</em>. The indicator's
507<em>order</em> is either Ascending or Descending.
508<p> Only one section can show a sort indicator at any one time. If you
509don't want any section to show a sort indicator pass a <em>section</em>
510number of -1.
511<p> <p>See also <a href="#sortIndicatorSection">sortIndicatorSection</a>() and <a href="#sortIndicatorOrder">sortIndicatorOrder</a>().
512
513<h3 class=fn>void <a name="setSortIndicator-2"></a>QHeader::setSortIndicator ( int&nbsp;section, bool&nbsp;ascending = TRUE )
514</h3> This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
515<p> <b>This function is obsolete.</b> It is provided to keep old source working. We strongly advise against using it in new code.
516<p> Use the other overload instead.
517
518<h3 class=fn>void <a name="setStretchEnabled"></a>QHeader::setStretchEnabled ( bool&nbsp;b, int&nbsp;section )<tt> [virtual]</tt>
519</h3>
520If <em>b</em> is TRUE, section <em>section</em> will be resized when the
521header is resized, so that the sections take up the full width (or
522height for vertical headers) of the header; otherwise section <em>section</em> will be set to be unstretchable and will not resize when
523the header is resized.
524<p> If <em>section</em> is -1, and if <em>b</em> is TRUE, then all sections will
525be resized equally when the header is resized so that they take up
526the full width (or height for vertical headers) of the header;
527otherwise all the sections will be set to be unstretchable and
528will not resize when the header is resized.
529<p> <p>See also <a href="#adjustHeaderSize">adjustHeaderSize</a>().
530
531<h3 class=fn>void <a name="setStretchEnabled-2"></a>QHeader::setStretchEnabled ( bool&nbsp;b )
532</h3><p>Sets whether the header sections always take up the full width (or height) of the header to <em>b</em>.
533See the <a href="qheader.html#stretching-prop">"stretching"</a> property for details.
534<h3 class=fn>void <a name="setTracking"></a>QHeader::setTracking ( bool&nbsp;enable )<tt> [virtual]</tt>
535</h3><p>Sets whether the <a href="#sizeChange">sizeChange</a>() signal is emitted continuously to <em>enable</em>.
536See the <a href="qheader.html#tracking-prop">"tracking"</a> property for details.
537<h3 class=fn>void <a name="sizeChange"></a>QHeader::sizeChange ( int&nbsp;section, int&nbsp;oldSize, int&nbsp;newSize )<tt> [signal]</tt>
538</h3>
539
540<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
541connected to a slot that repaints the table or list that contains
542the header.
543
544<h3 class=fn><a href="qt.html#SortOrder-enum">SortOrder</a> <a name="sortIndicatorOrder"></a>QHeader::sortIndicatorOrder () const
545</h3>
546Returns the implied sort order of the QHeaders sort indicator.
547<p> <p>See also <a href="#setSortIndicator">setSortIndicator</a>() and <a href="#sortIndicatorSection">sortIndicatorSection</a>().
548
549<h3 class=fn>int <a name="sortIndicatorSection"></a>QHeader::sortIndicatorSection () const
550</h3>
551Returns the section showing the sort indicator or -1 if there is no sort indicator.
552<p> <p>See also <a href="#setSortIndicator">setSortIndicator</a>() and <a href="#sortIndicatorOrder">sortIndicatorOrder</a>().
553
554<h3 class=fn>bool <a name="tracking"></a>QHeader::tracking () const
555</h3><p>Returns TRUE if the <a href="#sizeChange">sizeChange</a>() signal is emitted continuously; otherwise returns FALSE.
556See the <a href="qheader.html#tracking-prop">"tracking"</a> property for details.
557<hr><h2>Property Documentation</h2>
558<h3 class=fn>int <a name="count-prop"></a>count</h3>
559<p>This property holds the number of sections in the header.
560<p>
561<p>Get this property's value with <a href="#count">count</a>().
562<h3 class=fn>bool <a name="moving-prop"></a>moving</h3>
563<p>This property holds whether the header sections can be moved.
564<p>If this property is TRUE (the default) the user can move sections.
565If the user moves a section the <a href="#indexChange">indexChange</a>() signal is emitted.
566<p> <p>See also <a href="#setClickEnabled">setClickEnabled</a>() and <a href="#setResizeEnabled">setResizeEnabled</a>().
567
568<p>Set this property's value with <a href="#setMovingEnabled">setMovingEnabled</a>() and get this property's value with <a href="#isMovingEnabled">isMovingEnabled</a>().
569<h3 class=fn>int <a name="offset-prop"></a>offset</h3>
570<p>This property holds the header's left-most (or top-most) visible pixel.
571<p>Setting this property will scroll the header so that <em>offset</em>
572becomes the left-most (or top-most for vertical headers) visible
573pixel.
574
575<p>Set this property's value with <a href="#setOffset">setOffset</a>() and get this property's value with <a href="#offset">offset</a>().
576<h3 class=fn><a href="qt.html#Orientation-enum">Orientation</a> <a name="orientation-prop"></a>orientation</h3>
577<p>This property holds the header's orientation.
578<p>The orientation is either <a href="qt.html#Orientation-enum">Vertical</a> or <a href="qt.html#Orientation-enum">Horizontal</a> (the
579default).
580<p> Call <a href="#setOrientation">setOrientation</a>() before adding labels if you don't provide a
581size parameter otherwise the sizes will be incorrect.
582
583<p>Set this property's value with <a href="#setOrientation">setOrientation</a>() and get this property's value with <a href="#orientation">orientation</a>().
584<h3 class=fn>bool <a name="stretching-prop"></a>stretching</h3>
585<p>This property holds whether the header sections always take up the full width (or height) of the header.
586<p>
587<p>Set this property's value with <a href="#setStretchEnabled">setStretchEnabled</a>() and get this property's value with <a href="#isStretchEnabled">isStretchEnabled</a>().
588<h3 class=fn>bool <a name="tracking-prop"></a>tracking</h3>
589<p>This property holds whether the <a href="#sizeChange">sizeChange</a>() signal is emitted continuously.
590<p>If tracking is on, the sizeChange() signal is emitted continuously
591while the mouse is moved (i.e. when the header is resized),
592otherwise it is only emitted when the mouse button is released at
593the end of resizing.
594<p> Tracking defaults to FALSE.
595
596<p>Set this property's value with <a href="#setTracking">setTracking</a>() and get this property's value with <a href="#tracking">tracking</a>().
597<!-- eof -->
598<hr><p>
599This file is part of the <a href="index.html">Qt toolkit</a>.
600Copyright &copy; 1995-2007
601<a href="http://www.trolltech.com/">Trolltech</a>. All Rights Reserved.<p><address><hr><div align=center>
602<table width=100% cellspacing=0 border=0><tr>
603<td>Copyright &copy; 2007
604<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
605<td align=right><div align=right>Qt 3.3.8</div>
606</table></div></address></body>
607</html>
Note: See TracBrowser for help on using the repository browser.