~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to doc/html/q3header.html

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-08-24 04:09:09 UTC
  • Revision ID: james.westby@ubuntu.com-20050824040909-xmxe9jfr4a0w5671
Tags: upstream-4.0.0
ImportĀ upstreamĀ versionĀ 4.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?xml version="1.0" encoding="iso-8859-1"?>
 
2
<!DOCTYPE html
 
3
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
 
4
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
 
5
<!-- /tmp/qt-4.0.0-espenr-1119621036935/qt-x11-opensource-desktop-4.0.0/src/qt3support/widgets/q3header.cpp -->
 
6
<head>
 
7
    <title>Qt 4.0: Q3Header Class Reference</title>
 
8
    <style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm; }
 
9
a:link { color: #004faf; text-decoration: none }
 
10
a:visited { color: #672967; text-decoration: none }
 
11
td.postheader { font-family: sans-serif }
 
12
tr.address { font-family: sans-serif }
 
13
body { background: #ffffff; color: black; }</style>
 
14
</head>
 
15
<body>
 
16
<table border="0" cellpadding="0" cellspacing="0" width="100%">
 
17
<tr>
 
18
<td align="left" valign="top" width="32"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></td>
 
19
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="annotated.html"><font color="#004faf">Annotated</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
 
20
<td align="right" valign="top" width="230"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></td></tr></table><h1 align="center">Q3Header Class Reference</h1>
 
21
<p>The Q3Header class provides a header row or column, e.g. for tables and listviews. <a href="#details">More...</a></p>
 
22
<pre>#include &lt;Q3Header&gt;</pre><p><b>This class is part of the Qt 3 support library.</b> It is provided to keep old source code working. We strongly advise against using it in new code. See the <a href="porting4.html">Porting Guide</a> for more information.</p>
 
23
<p>Part of the <a href="qt3support.html">Qt3Support</a> module.</p>
 
24
<p>Inherits <a href="qwidget.html">QWidget</a>.</p>
 
25
<ul>
 
26
<li><a href="q3header-members.html">List of all members, including inherited members</a></li>
 
27
</ul>
 
28
<a name="properties"></a>
 
29
<h3>Properties</h3>
 
30
<table width="100%" border="0" cellpadding="0" cellspacing="0">
 
31
<tr><td width="45%" valign="top"><ul>
 
32
<li><div class="fn"/><b><a href="q3header.html#count-prop">count</a></b> : const int</li>
 
33
<li><div class="fn"/><b><a href="q3header.html#moving-prop">moving</a></b> : bool</li>
 
34
<li><div class="fn"/><b><a href="q3header.html#offset-prop">offset</a></b> : int</li>
 
35
</ul></td><td valign="top"><ul>
 
36
<li><div class="fn"/><b><a href="q3header.html#orientation-prop">orientation</a></b> : Qt::Orientation</li>
 
37
<li><div class="fn"/><b><a href="q3header.html#stretching-prop">stretching</a></b> : bool</li>
 
38
<li><div class="fn"/><b><a href="q3header.html#tracking-prop">tracking</a></b> : bool</li>
 
39
</ul>
 
40
</td></tr>
 
41
</table>
 
42
<ul>
 
43
<li><div class="fn"/>52 properties inherited from <a href="qwidget.html#properties">QWidget</a></li>
 
44
<li><div class="fn"/>1 property inherited from <a href="qobject.html#properties">QObject</a></li>
 
45
</ul>
 
46
<a name="public-functions"></a>
 
47
<h3>Public Functions</h3>
 
48
<ul>
 
49
<li><div class="fn"/><b><a href="q3header.html#Q3Header">Q3Header</a></b> ( QWidget * <i>parent</i> = 0, const char * <i>name</i> = 0 )</li>
 
50
<li><div class="fn"/><b><a href="q3header.html#Q3Header-2">Q3Header</a></b> ( int <i>n</i>, QWidget * <i>parent</i> = 0, const char * <i>name</i> = 0 )</li>
 
51
<li><div class="fn"/><b><a href="q3header.html#dtor.Q3Header">~Q3Header</a></b> ()</li>
 
52
<li><div class="fn"/>int <b><a href="q3header.html#addLabel">addLabel</a></b> ( const QString &amp; <i>s</i>, int <i>size</i> = -1 )</li>
 
53
<li><div class="fn"/>int <b><a href="q3header.html#addLabel-2">addLabel</a></b> ( const QIcon &amp; <i>icon</i>, const QString &amp; <i>s</i>, int <i>size</i> = -1 )</li>
 
54
<li><div class="fn"/>void <b><a href="q3header.html#adjustHeaderSize">adjustHeaderSize</a></b> ()</li>
 
55
<li><div class="fn"/>int <b><a href="q3header.html#cellAt">cellAt</a></b> ( int <i>pos</i> ) const</li>
 
56
<li><div class="fn"/>int <b><a href="q3header.html#cellPos">cellPos</a></b> ( int <i>i</i> ) const</li>
 
57
<li><div class="fn"/>int <b><a href="q3header.html#cellSize">cellSize</a></b> ( int <i>i</i> ) const</li>
 
58
<li><div class="fn"/>int <b><a href="q3header.html#count-prop">count</a></b> () const</li>
 
59
<li><div class="fn"/>int <b><a href="q3header.html#headerWidth">headerWidth</a></b> () const</li>
 
60
<li><div class="fn"/>QIcon * <b><a href="q3header.html#iconSet">iconSet</a></b> ( int <i>section</i> ) const</li>
 
61
<li><div class="fn"/>bool <b><a href="q3header.html#isClickEnabled">isClickEnabled</a></b> ( int <i>section</i> = -1 ) const</li>
 
62
<li><div class="fn"/>bool <b><a href="q3header.html#moving-prop">isMovingEnabled</a></b> () const</li>
 
63
<li><div class="fn"/>bool <b><a href="q3header.html#isResizeEnabled">isResizeEnabled</a></b> ( int <i>section</i> = -1 ) const</li>
 
64
<li><div class="fn"/>bool <b><a href="q3header.html#stretching-prop">isStretchEnabled</a></b> () const</li>
 
65
<li><div class="fn"/>bool <b><a href="q3header.html#stretching-prop">isStretchEnabled</a></b> ( int <i>section</i> ) const</li>
 
66
<li><div class="fn"/>QString <b><a href="q3header.html#label">label</a></b> ( int <i>section</i> ) const</li>
 
67
<li><div class="fn"/>int <b><a href="q3header.html#mapToActual">mapToActual</a></b> ( int <i>l</i> ) const</li>
 
68
<li><div class="fn"/>int <b><a href="q3header.html#mapToIndex">mapToIndex</a></b> ( int <i>section</i> ) const</li>
 
69
<li><div class="fn"/>int <b><a href="q3header.html#mapToLogical">mapToLogical</a></b> ( int <i>a</i> ) const</li>
 
70
<li><div class="fn"/>int <b><a href="q3header.html#mapToSection">mapToSection</a></b> ( int <i>index</i> ) const</li>
 
71
<li><div class="fn"/>virtual void <b><a href="q3header.html#moveCell">moveCell</a></b> ( int <i>fromIdx</i>, int <i>toIdx</i> )</li>
 
72
<li><div class="fn"/>void <b><a href="q3header.html#moveSection">moveSection</a></b> ( int <i>section</i>, int <i>toIndex</i> )</li>
 
73
<li><div class="fn"/>int <b><a href="q3header.html#offset-prop">offset</a></b> () const</li>
 
74
<li><div class="fn"/>Qt::Orientation <b><a href="q3header.html#orientation-prop">orientation</a></b> () const</li>
 
75
<li><div class="fn"/>void <b><a href="q3header.html#removeLabel">removeLabel</a></b> ( int <i>section</i> )</li>
 
76
<li><div class="fn"/>void <b><a href="q3header.html#resizeSection">resizeSection</a></b> ( int <i>section</i>, int <i>s</i> )</li>
 
77
<li><div class="fn"/>int <b><a href="q3header.html#sectionAt">sectionAt</a></b> ( int <i>pos</i> ) const</li>
 
78
<li><div class="fn"/>int <b><a href="q3header.html#sectionPos">sectionPos</a></b> ( int <i>section</i> ) const</li>
 
79
<li><div class="fn"/>QRect <b><a href="q3header.html#sectionRect">sectionRect</a></b> ( int <i>section</i> ) const</li>
 
80
<li><div class="fn"/>int <b><a href="q3header.html#sectionSize">sectionSize</a></b> ( int <i>section</i> ) const</li>
 
81
<li><div class="fn"/>virtual void <b><a href="q3header.html#setCellSize">setCellSize</a></b> ( int <i>section</i>, int <i>s</i> )</li>
 
82
<li><div class="fn"/>virtual void <b><a href="q3header.html#setClickEnabled">setClickEnabled</a></b> ( bool <i>enable</i>, int <i>section</i> = -1 )</li>
 
83
<li><div class="fn"/>virtual void <b><a href="q3header.html#setLabel">setLabel</a></b> ( int <i>section</i>, const QString &amp; <i>s</i>, int <i>size</i> = -1 )</li>
 
84
<li><div class="fn"/>virtual void <b><a href="q3header.html#setLabel-2">setLabel</a></b> ( int <i>section</i>, const QIcon &amp; <i>icon</i>, const QString &amp; <i>s</i>, int <i>size</i> = -1 )</li>
 
85
<li><div class="fn"/>virtual void <b><a href="q3header.html#moving-prop">setMovingEnabled</a></b> ( bool )</li>
 
86
<li><div class="fn"/>virtual void <b><a href="q3header.html#orientation-prop">setOrientation</a></b> ( Qt::Orientation )</li>
 
87
<li><div class="fn"/>virtual void <b><a href="q3header.html#setResizeEnabled">setResizeEnabled</a></b> ( bool <i>enable</i>, int <i>section</i> = -1 )</li>
 
88
<li><div class="fn"/>void <b><a href="q3header.html#setSortIndicator">setSortIndicator</a></b> ( int <i>section</i>, Qt::SortOrder <i>order</i> )</li>
 
89
<li><div class="fn"/>void <b><a href="q3header.html#setSortIndicator-2">setSortIndicator</a></b> ( int <i>section</i>, bool <i>ascending</i> = true )</li>
 
90
<li><div class="fn"/>virtual void <b><a href="q3header.html#stretching-prop">setStretchEnabled</a></b> ( bool <i>b</i>, int <i>section</i> )</li>
 
91
<li><div class="fn"/>void <b><a href="q3header.html#stretching-prop">setStretchEnabled</a></b> ( bool <i>b</i> )</li>
 
92
<li><div class="fn"/>virtual void <b><a href="q3header.html#tracking-prop">setTracking</a></b> ( bool <i>enable</i> )</li>
 
93
<li><div class="fn"/>Qt::SortOrder <b><a href="q3header.html#sortIndicatorOrder">sortIndicatorOrder</a></b> () const</li>
 
94
<li><div class="fn"/>int <b><a href="q3header.html#sortIndicatorSection">sortIndicatorSection</a></b> () const</li>
 
95
<li><div class="fn"/>bool <b><a href="q3header.html#tracking-prop">tracking</a></b> () const</li>
 
96
</ul>
 
97
<ul>
 
98
<li><div class="fn"/>183 public functions inherited from <a href="qwidget.html#public-functions">QWidget</a></li>
 
99
<li><div class="fn"/>28 public functions inherited from <a href="qobject.html#public-functions">QObject</a></li>
 
100
<li><div class="fn"/>10 public functions inherited from <a href="qpaintdevice.html#public-functions">QPaintDevice</a></li>
 
101
</ul>
 
102
<a name="public-slots"></a>
 
103
<h3>Public Slots</h3>
 
104
<ul>
 
105
<li><div class="fn"/>virtual void <b><a href="q3header.html#offset-prop">setOffset</a></b> ( int <i>pos</i> )</li>
 
106
</ul>
 
107
<ul>
 
108
<li><div class="fn"/>17 public slots inherited from <a href="qwidget.html#public-slots">QWidget</a></li>
 
109
<li><div class="fn"/>1 public slot inherited from <a href="qobject.html#public-slots">QObject</a></li>
 
110
</ul>
 
111
<a name="signals"></a>
 
112
<h3>Signals</h3>
 
113
<ul>
 
114
<li><div class="fn"/>void <b><a href="q3header.html#clicked">clicked</a></b> ( int <i>section</i> )</li>
 
115
<li><div class="fn"/>void <b><a href="q3header.html#indexChange">indexChange</a></b> ( int <i>section</i>, int <i>fromIndex</i>, int <i>toIndex</i> )</li>
 
116
<li><div class="fn"/>void <b><a href="q3header.html#moved">moved</a></b> ( int <i>fromIndex</i>, int <i>toIndex</i> )</li>
 
117
<li><div class="fn"/>void <b><a href="q3header.html#pressed">pressed</a></b> ( int <i>section</i> )</li>
 
118
<li><div class="fn"/>void <b><a href="q3header.html#released">released</a></b> ( int <i>section</i> )</li>
 
119
<li><div class="fn"/>void <b><a href="q3header.html#sectionClicked">sectionClicked</a></b> ( int <i>index</i> )</li>
 
120
<li><div class="fn"/>void <b><a href="q3header.html#sectionHandleDoubleClicked">sectionHandleDoubleClicked</a></b> ( int <i>section</i> )</li>
 
121
<li><div class="fn"/>void <b><a href="q3header.html#sizeChange">sizeChange</a></b> ( int <i>section</i>, int <i>oldSize</i>, int <i>newSize</i> )</li>
 
122
</ul>
 
123
<ul>
 
124
<li><div class="fn"/>1 signal inherited from <a href="qwidget.html#signals">QWidget</a></li>
 
125
<li><div class="fn"/>1 signal inherited from <a href="qobject.html#signals">QObject</a></li>
 
126
</ul>
 
127
<a name="protected-functions"></a>
 
128
<h3>Protected Functions</h3>
 
129
<ul>
 
130
<li><div class="fn"/>virtual void <b><a href="q3header.html#paintSection">paintSection</a></b> ( QPainter * <i>p</i>, int <i>index</i>, const QRect &amp; <i>fr</i> )</li>
 
131
<li><div class="fn"/>virtual void <b><a href="q3header.html#paintSectionLabel">paintSectionLabel</a></b> ( QPainter * <i>p</i>, int <i>index</i>, const QRect &amp; <i>fr</i> )</li>
 
132
<li><div class="fn"/>QRect <b><a href="q3header.html#sRect">sRect</a></b> ( int <i>index</i> )</li>
 
133
</ul>
 
134
<ul>
 
135
<li><div class="fn"/>39 protected functions inherited from <a href="qwidget.html#protected-functions">QWidget</a></li>
 
136
<li><div class="fn"/>7 protected functions inherited from <a href="qobject.html#protected-functions">QObject</a></li>
 
137
</ul>
 
138
<h3>Additional Inherited Members</h3>
 
139
<ul>
 
140
<li><div class="fn"/>4 static public members inherited from <a href="qwidget.html#static-public-members">QWidget</a></li>
 
141
<li><div class="fn"/>4 static public members inherited from <a href="qobject.html#static-public-members">QObject</a></li>
 
142
</ul>
 
143
<a name="details"></a>
 
144
<hr />
 
145
<h2>Detailed Description</h2>
 
146
<p>The Q3Header class provides a header row or column, e.g. for tables and listviews.</p>
 
147
<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="q3table.html">Q3Table</a> and <a href="q3listview.html">Q3ListView</a> for example.</p>
 
148
<p>A header is composed of one or more <i>sections</i>, each of which can display a text label and an <a href="qicon.html">icon</a>. A sort indicator (an arrow) can also be displayed using <a href="q3header.html#setSortIndicator">setSortIndicator</a>().</p>
 
149
<p>Sections are added with <a href="q3header.html#addLabel">addLabel</a>() and removed with <a href="q3header.html#removeLabel">removeLabel</a>(). The label and icon are set in <a href="q3header.html#addLabel">addLabel</a>() and can be changed later with <a href="q3header.html#setLabel">setLabel</a>(). Use <a href="q3header.html#count-prop">count</a>() to retrieve the number of sections in the header.</p>
 
150
<p>The orientation of the header is set with <a href="q3header.html#orientation-prop">setOrientation</a>(). If <a href="q3header.html#stretching-prop">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="q3header.html#setResizeEnabled">setResizeEnabled</a>() is true. Call <a href="q3header.html#adjustHeaderSize">adjustHeaderSize</a>() to have the sections resize to occupy the full width (or height).</p>
 
151
<p>A section can be moved with <a href="q3header.html#moveSection">moveSection</a>(). If <a href="q3header.html#moving-prop">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="q3header.html#addLabel">addLabel</a>()), may not be the same after the move. You don't have to worry about this in practice because the Q3Header API works in terms of section numbers, so it doesn't matter where a particular section has been moved to.</p>
 
152
<p>If you want the current index position of a section call <a href="q3header.html#mapToIndex">mapToIndex</a>() giving it the section number. (This is the number returned by the <a href="q3header.html#addLabel">addLabel</a>() call which created the section.) If you want to get the section number of a section at a particular index position call <a href="q3header.html#mapToSection">mapToSection</a>() giving it the index number.</p>
 
153
<p>Here's an example to clarify <a href="q3header.html#mapToSection">mapToSection</a>() and <a href="q3header.html#mapToIndex">mapToIndex</a>():</p>
 
154
<table align="center" cellpadding="2" cellspacing="1" border="0">
 
155
<tr valign="top" bgcolor="#a2c511"><th colspan="4">Index positions</th></tr>
 
156
<tr valign="top" bgcolor="#f0f0f0"><td>0</td><td>1</td><td>2</td><td>3</td></tr>
 
157
<tr valign="top" bgcolor="#a2c511"><th colspan="4">Original section ordering</th></tr>
 
158
<tr valign="top" bgcolor="#e0e0e0"><td>Sect 0</td><td>Sect 1</td><td>Sect 2</td><td>Sect 3</td></tr>
 
159
<tr valign="top" bgcolor="#a2c511"><th colspan="4">Ordering after the user moves a section</th></tr>
 
160
<tr valign="top" bgcolor="#f0f0f0"><td>Sect 0</td><td>Sect 2</td><td>Sect 3</td><td>Sect 1</td></tr>
 
161
</table>
 
162
<table align="center" cellpadding="2" cellspacing="1" border="0">
 
163
<tr valign="top" bgcolor="#a2c511"><th><i>k</i></th><th>mapToSection(<i>k</i>)</th><th>mapToIndex(<i>k</i>)</th></tr>
 
164
<tr valign="top" bgcolor="#f0f0f0"><td>0</td><td>0</td><td>0</td></tr>
 
165
<tr valign="top" bgcolor="#e0e0e0"><td>1</td><td>2</td><td>3</td></tr>
 
166
<tr valign="top" bgcolor="#f0f0f0"><td>2</td><td>3</td><td>1</td></tr>
 
167
<tr valign="top" bgcolor="#e0e0e0"><td>3</td><td>1</td><td>2</td></tr>
 
168
</table>
 
169
<p>In the example above, if we wanted to find out which section is at index position 3 we'd call mapToSection(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 mapToIndex(2) and get an index of 1.</p>
 
170
<p>Q3Header provides the <a href="q3header.html#clicked">clicked</a>(), <a href="q3header.html#pressed">pressed</a>() and <a href="q3header.html#released">released</a>() signals. If the user changes the size of a section, the <a href="q3header.html#sizeChange">sizeChange</a>() signal is emitted. If you want to have a <a href="q3header.html#sizeChange">sizeChange</a>() signal emitted continuously whilst the user is resizing (rather than just after the resizing is finished), use <a href="q3header.html#tracking-prop">setTracking</a>(). If the user moves a section the <a href="q3header.html#indexChange">indexChange</a>() signal is emitted.</p>
 
171
<p>See also <a href="q3listview.html">Q3ListView</a> and <a href="q3table.html">Q3Table</a>.</p>
 
172
<hr />
 
173
<h2>Property Documentation</h2>
 
174
<h3 class="fn"><a name="count-prop"></a>count : const int</h3>
 
175
<p>This property holds the number of sections in the header.</p>
 
176
<p>Access functions:</p>
 
177
<ul>
 
178
<li><div class="fn"/><b>int count () const</b></li>
 
179
</ul>
 
180
<h3 class="fn"><a name="moving-prop"></a>moving : bool</h3>
 
181
<p>This property holds whether the header sections can be moved.</p>
 
182
<p>If this property is true (the default) the user can move sections. If the user moves a section the <a href="q3header.html#indexChange">indexChange</a>() signal is emitted.</p>
 
183
<p>Access functions:</p>
 
184
<ul>
 
185
<li><div class="fn"/><b>bool isMovingEnabled () const</b></li>
 
186
<li><div class="fn"/><b>virtual void setMovingEnabled ( bool )</b></li>
 
187
</ul>
 
188
<p>See also <a href="q3header.html#setClickEnabled">setClickEnabled</a>() and <a href="q3header.html#setResizeEnabled">setResizeEnabled</a>().</p>
 
189
<h3 class="fn"><a name="offset-prop"></a>offset : int</h3>
 
190
<p>This property holds the header's left-most (or top-most) visible pixel.</p>
 
191
<p>Setting this property will scroll the header so that <i>offset</i> becomes the left-most (or top-most for vertical headers) visible pixel.</p>
 
192
<p>Access functions:</p>
 
193
<ul>
 
194
<li><div class="fn"/><b>int offset () const</b></li>
 
195
<li><div class="fn"/><b>virtual void setOffset ( int <i>pos</i> )</b></li>
 
196
</ul>
 
197
<h3 class="fn"><a name="orientation-prop"></a>orientation : <a href="qt.html#Orientation-enum">Qt::Orientation</a></h3>
 
198
<p>This property holds the header's orientation.</p>
 
199
<p>The orientation is either <tt>Qt::Vertical</tt> or <tt>Qt::Horizontal</tt> (the default).</p>
 
200
<p>Call setOrientation() before adding labels if you don't provide a size parameter otherwise the sizes will be incorrect.</p>
 
201
<p>Access functions:</p>
 
202
<ul>
 
203
<li><div class="fn"/><b>Qt::Orientation orientation () const</b></li>
 
204
<li><div class="fn"/><b>virtual void setOrientation ( Qt::Orientation )</b></li>
 
205
</ul>
 
206
<h3 class="fn"><a name="stretching-prop"></a>stretching : bool</h3>
 
207
<p>This property holds whether the header sections always take up the full width (or height) of the header.</p>
 
208
<p>Access functions:</p>
 
209
<ul>
 
210
<li><div class="fn"/><b>bool isStretchEnabled () const</b></li>
 
211
<li><div class="fn"/><b>bool isStretchEnabled ( int <i>section</i> ) const</b></li>
 
212
<li><div class="fn"/><b>virtual void setStretchEnabled ( bool <i>b</i>, int <i>section</i> )</b></li>
 
213
<li><div class="fn"/><b>void setStretchEnabled ( bool <i>b</i> )</b></li>
 
214
</ul>
 
215
<h3 class="fn"><a name="tracking-prop"></a>tracking : bool</h3>
 
216
<p>This property holds whether the sizeChange() signal is emitted continuously.</p>
 
217
<p>If tracking is on, the <a href="q3header.html#sizeChange">sizeChange</a>() 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>
 
218
<p>Tracking defaults to false.</p>
 
219
<p>Access functions:</p>
 
220
<ul>
 
221
<li><div class="fn"/><b>bool tracking () const</b></li>
 
222
<li><div class="fn"/><b>virtual void setTracking ( bool <i>enable</i> )</b></li>
 
223
</ul>
 
224
<hr />
 
225
<h2>Member Function Documentation</h2>
 
226
<h3 class="fn"><a name="Q3Header"></a>Q3Header::Q3Header ( <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0, const char * <i>name</i> = 0 )</h3>
 
227
<p>Constructs a horizontal header called <i>name</i>, with parent <i>parent</i>.</p>
 
228
<h3 class="fn"><a name="Q3Header-2"></a>Q3Header::Q3Header ( int <i>n</i>, <a href="qwidget.html">QWidget</a> * <i>parent</i> = 0, const char * <i>name</i> = 0 )</h3>
 
229
<p>Constructs a horizontal header called <i>name</i>, with <i>n</i> sections and parent <i>parent</i>.</p>
 
230
<h3 class="fn"><a name="dtor.Q3Header"></a>Q3Header::~Q3Header ()</h3>
 
231
<p>Destroys the header and all its sections.</p>
 
232
<h3 class="fn"><a name="addLabel"></a>int Q3Header::addLabel ( const <a href="qstring.html">QString</a> &amp; <i>s</i>, int <i>size</i> = -1 )</h3>
 
233
<p>Adds a new section with label text <i>s</i>. 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 <i>size</i>. If <i>size</i> &lt; 0, an appropriate size for the text <i>s</i> is chosen.</p>
 
234
<h3 class="fn"><a name="addLabel-2"></a>int Q3Header::addLabel ( const <a href="qicon.html">QIcon</a> &amp; <i>icon</i>, const <a href="qstring.html">QString</a> &amp; <i>s</i>, int <i>size</i> = -1 )</h3>
 
235
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
236
<p>Adds a new section with icon <i>icon</i> and label text <i>s</i>. 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 <i>size</i>, unless size is negative in which case the size is calculated taking account of the size of the text.</p>
 
237
<h3 class="fn"><a name="adjustHeaderSize"></a>void Q3Header::adjustHeaderSize ()</h3>
 
238
<p>Adjusts the size of the sections to fit the size of the header as completely as possible. Only sections for which <a href="q3header.html#stretching-prop">isStretchEnabled</a>() is true will be resized.</p>
 
239
<h3 class="fn"><a name="cellAt"></a>int Q3Header::cellAt ( int <i>pos</i> ) const</h3>
 
240
<p>Use <a href="q3header.html#sectionAt">sectionAt</a>() instead.</p>
 
241
<p>Returns the index at which the section is displayed, which contains <i>pos</i> in widget coordinates, or -1 if <i>pos</i> is outside the header sections.</p>
 
242
<h3 class="fn"><a name="cellPos"></a>int Q3Header::cellPos ( int <i>i</i> ) const</h3>
 
243
<p>Use <a href="q3header.html#sectionPos">sectionPos</a>() instead.</p>
 
244
<p>Returns the position in pixels of the section that is displayed at the index <i>i</i>. The position is measured from the start of the header.</p>
 
245
<h3 class="fn"><a name="cellSize"></a>int Q3Header::cellSize ( int <i>i</i> ) const</h3>
 
246
<p>Use <a href="q3header.html#sectionSize">sectionSize</a>() instead.</p>
 
247
<p>Returns the size in pixels of the section that is displayed at the index <i>i</i>.</p>
 
248
<h3 class="fn"><a name="clicked"></a>void Q3Header::clicked ( int <i>section</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
249
<p>If <a href="q3header.html#isClickEnabled">isClickEnabled</a>() is true, this signal is emitted when the user clicks section <i>section</i>.</p>
 
250
<p>See also <a href="q3header.html#pressed">pressed</a>() and <a href="q3header.html#released">released</a>().</p>
 
251
<h3 class="fn"><a name="headerWidth"></a>int Q3Header::headerWidth () const</h3>
 
252
<p>Returns the total width of all the header columns.</p>
 
253
<h3 class="fn"><a name="iconSet"></a><a href="qicon.html">QIcon</a> * Q3Header::iconSet ( int <i>section</i> ) const</h3>
 
254
<p>Returns the icon set for section <i>section</i>. If the section does not exist, 0 is returned.</p>
 
255
<h3 class="fn"><a name="indexChange"></a>void Q3Header::indexChange ( int <i>section</i>, int <i>fromIndex</i>, int <i>toIndex</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
256
<p>This signal is emitted when the user moves section <i>section</i> from index position <i>fromIndex</i>, to index position <i>toIndex</i>.</p>
 
257
<h3 class="fn"><a name="isClickEnabled"></a>bool Q3Header::isClickEnabled ( int <i>section</i> = -1 ) const</h3>
 
258
<p>Returns true if section <i>section</i> is clickable; otherwise returns false.</p>
 
259
<p>If <i>section</i> is out of range (negative or larger than <a href="q3header.html#count-prop">count</a>() - 1): returns true if all sections are clickable; otherwise returns false.</p>
 
260
<p>See also <a href="q3header.html#setClickEnabled">setClickEnabled</a>().</p>
 
261
<h3 class="fn"><a name="isResizeEnabled"></a>bool Q3Header::isResizeEnabled ( int <i>section</i> = -1 ) const</h3>
 
262
<p>Returns true if section <i>section</i> is resizeable; otherwise returns false.</p>
 
263
<p>If <i>section</i> is -1 then this function applies to all sections, i.e. returns true if all sections are resizeable; otherwise returns false.</p>
 
264
<p>See also <a href="q3header.html#setResizeEnabled">setResizeEnabled</a>().</p>
 
265
<h3 class="fn"><a name="label"></a><a href="qstring.html">QString</a> Q3Header::label ( int <i>section</i> ) const</h3>
 
266
<p>Returns the text for section <i>section</i>. If the section does not exist, returns an empty string.</p>
 
267
<h3 class="fn"><a name="mapToActual"></a>int Q3Header::mapToActual ( int <i>l</i> ) const</h3>
 
268
<p>Use <a href="q3header.html#mapToIndex">mapToIndex</a>() instead.</p>
 
269
<p>Translates from logical index <i>l</i> to actual index (index at which the section <i>l</i> is displayed) . Returns -1 if <i>l</i> is outside the legal range.</p>
 
270
<p>See also <a href="q3header.html#mapToLogical">mapToLogical</a>().</p>
 
271
<h3 class="fn"><a name="mapToIndex"></a>int Q3Header::mapToIndex ( int <i>section</i> ) const</h3>
 
272
<p>Returns the index position at which section <i>section</i> is displayed.</p>
 
273
<h3 class="fn"><a name="mapToLogical"></a>int Q3Header::mapToLogical ( int <i>a</i> ) const</h3>
 
274
<p>Use <a href="q3header.html#mapToSection">mapToSection</a>() instead.</p>
 
275
<p>Translates from actual index <i>a</i> (index at which the section is displayed) to logical index of the section. Returns -1 if <i>a</i> is outside the legal range.</p>
 
276
<p>See also <a href="q3header.html#mapToActual">mapToActual</a>().</p>
 
277
<h3 class="fn"><a name="mapToSection"></a>int Q3Header::mapToSection ( int <i>index</i> ) const</h3>
 
278
<p>Returns the number of the section that is displayed at index position <i>index</i>.</p>
 
279
<h3 class="fn"><a name="moveCell"></a>void Q3Header::moveCell ( int <i>fromIdx</i>, int <i>toIdx</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
280
<p>Use <a href="q3header.html#moveSection">moveSection</a>() instead.</p>
 
281
<p>Moves the section that is currently displayed at index <i>fromIdx</i> to index <i>toIdx</i>.</p>
 
282
<h3 class="fn"><a name="moveSection"></a>void Q3Header::moveSection ( int <i>section</i>, int <i>toIndex</i> )</h3>
 
283
<p>Moves section <i>section</i> to index position <i>toIndex</i>.</p>
 
284
<h3 class="fn"><a name="moved"></a>void Q3Header::moved ( int <i>fromIndex</i>, int <i>toIndex</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
285
<p>Use <a href="q3header.html#indexChange">indexChange</a>() instead.</p>
 
286
<p>This signal is emitted when the user has moved the section which is displayed at the index <i>fromIndex</i> to the index <i>toIndex</i>.</p>
 
287
<h3 class="fn"><a name="paintSection"></a>void Q3Header::paintSection ( <a href="qpainter.html">QPainter</a> * <i>p</i>, int <i>index</i>, const <a href="qrect.html">QRect</a> &amp; <i>fr</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
 
288
<p>Paints the section at position <i>index</i>, inside rectangle <i>fr</i> (which uses widget coordinates) using painter <i>p</i>.</p>
 
289
<p>Calls <a href="q3header.html#paintSectionLabel">paintSectionLabel</a>().</p>
 
290
<h3 class="fn"><a name="paintSectionLabel"></a>void Q3Header::paintSectionLabel ( <a href="qpainter.html">QPainter</a> * <i>p</i>, int <i>index</i>, const <a href="qrect.html">QRect</a> &amp; <i>fr</i> )&nbsp;&nbsp;<tt> [virtual protected]</tt></h3>
 
291
<p>Paints the label of the section at position <i>index</i>, inside rectangle <i>fr</i> (which uses widget coordinates) using painter <i>p</i>.</p>
 
292
<p>Called by <a href="q3header.html#paintSection">paintSection</a>()</p>
 
293
<h3 class="fn"><a name="pressed"></a>void Q3Header::pressed ( int <i>section</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
294
<p>This signal is emitted when the user presses section <i>section</i> down.</p>
 
295
<p>See also <a href="q3header.html#released">released</a>().</p>
 
296
<h3 class="fn"><a name="released"></a>void Q3Header::released ( int <i>section</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
297
<p>This signal is emitted when section <i>section</i> is released.</p>
 
298
<p>See also <a href="q3header.html#pressed">pressed</a>().</p>
 
299
<h3 class="fn"><a name="removeLabel"></a>void Q3Header::removeLabel ( int <i>section</i> )</h3>
 
300
<p>Removes section <i>section</i>. If the section does not exist, nothing happens.</p>
 
301
<h3 class="fn"><a name="resizeSection"></a>void Q3Header::resizeSection ( int <i>section</i>, int <i>s</i> )</h3>
 
302
<p>Resizes section <i>section</i> to <i>s</i> pixels wide (or high).</p>
 
303
<h3 class="fn"><a name="sRect"></a><a href="qrect.html">QRect</a> Q3Header::sRect ( int <i>index</i> )&nbsp;&nbsp;<tt> [protected]</tt></h3>
 
304
<p>Returns the rectangle covered by the section at index <i>index</i>.</p>
 
305
<h3 class="fn"><a name="sectionAt"></a>int Q3Header::sectionAt ( int <i>pos</i> ) const</h3>
 
306
<p>Returns the index of the section which contains the position <i>pos</i> given in pixels from the left (or top).</p>
 
307
<p>See also <a href="q3header.html#offset-prop">offset</a>().</p>
 
308
<h3 class="fn"><a name="sectionClicked"></a>void Q3Header::sectionClicked ( int <i>index</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
309
<p>Use <a href="q3header.html#clicked">clicked</a>() instead.</p>
 
310
<p>This signal is emitted when a part of the header is clicked. <i>index</i> is the index at which the section is displayed.</p>
 
311
<p>In a list view this signal would typically be connected to a slot that sorts the specified column (or row).</p>
 
312
<h3 class="fn"><a name="sectionHandleDoubleClicked"></a>void Q3Header::sectionHandleDoubleClicked ( int <i>section</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
313
<p>This signal is emitted when the user doubleclicks on the edge (handle) of section <i>section</i>.</p>
 
314
<h3 class="fn"><a name="sectionPos"></a>int Q3Header::sectionPos ( int <i>section</i> ) const</h3>
 
315
<p>Returns the position (in pixels) at which the <i>section</i> starts.</p>
 
316
<p>See also <a href="q3header.html#offset-prop">offset</a>().</p>
 
317
<h3 class="fn"><a name="sectionRect"></a><a href="qrect.html">QRect</a> Q3Header::sectionRect ( int <i>section</i> ) const</h3>
 
318
<p>Returns the rectangle covered by section <i>section</i>.</p>
 
319
<h3 class="fn"><a name="sectionSize"></a>int Q3Header::sectionSize ( int <i>section</i> ) const</h3>
 
320
<p>Returns the width (or height) of the <i>section</i> in pixels.</p>
 
321
<h3 class="fn"><a name="setCellSize"></a>void Q3Header::setCellSize ( int <i>section</i>, int <i>s</i> )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
322
<p>Use <a href="q3header.html#resizeSection">resizeSection</a>() instead.</p>
 
323
<p>Sets the size of the section <i>section</i> to <i>s</i> pixels.</p>
 
324
<p><b>Warning:</b> does not repaint or send out signals</p>
 
325
<h3 class="fn"><a name="setClickEnabled"></a>void Q3Header::setClickEnabled ( bool <i>enable</i>, int <i>section</i> = -1 )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
326
<p>If <i>enable</i> is true, any clicks on section <i>section</i> will result in <a href="q3header.html#clicked">clicked</a>() signals being emitted; otherwise the section will ignore clicks.</p>
 
327
<p>If <i>section</i> is -1 (the default) then the <i>enable</i> value is set for all existing sections and will be applied to any new sections that are added.</p>
 
328
<p>See also <a href="q3header.html#moving-prop">setMovingEnabled</a>() and <a href="q3header.html#setResizeEnabled">setResizeEnabled</a>().</p>
 
329
<h3 class="fn"><a name="setLabel"></a>void Q3Header::setLabel ( int <i>section</i>, const <a href="qstring.html">QString</a> &amp; <i>s</i>, int <i>size</i> = -1 )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
330
<p>Sets the text of section <i>section</i> to <i>s</i>. The section's width is set to <i>size</i> if <i>size</i> &gt;= 0; otherwise it is left unchanged. Any icon set that has been set for this section remains unchanged.</p>
 
331
<p>If the section does not exist, nothing happens.</p>
 
332
<h3 class="fn"><a name="setLabel-2"></a>void Q3Header::setLabel ( int <i>section</i>, const <a href="qicon.html">QIcon</a> &amp; <i>icon</i>, const <a href="qstring.html">QString</a> &amp; <i>s</i>, int <i>size</i> = -1 )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
333
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
334
<p>Sets the icon for section <i>section</i> to <i>icon</i> and the text to <i>s</i>. The section's width is set to <i>size</i> if <i>size</i> &gt;= 0; otherwise it is left unchanged.</p>
 
335
<p>If the section does not exist, nothing happens.</p>
 
336
<h3 class="fn"><a name="setResizeEnabled"></a>void Q3Header::setResizeEnabled ( bool <i>enable</i>, int <i>section</i> = -1 )&nbsp;&nbsp;<tt> [virtual]</tt></h3>
 
337
<p>If <i>enable</i> is true the user may resize section <i>section</i>; otherwise the section may not be manually resized.</p>
 
338
<p>If <i>section</i> is negative (the default) then the <i>enable</i> value is set for all existing sections and will be applied to any new sections that are added. Example:</p>
 
339
<pre>&nbsp;   // Allow resizing of all current and future sections
 
340
    header-&gt;setResizeEnabled(true);
 
341
    // Disable resizing of section 3, (the fourth section added)
 
342
    header-&gt;setResizeEnabled(false, 3);</pre>
 
343
<p>If the user resizes a section, a <a href="q3header.html#sizeChange">sizeChange</a>() signal is emitted.</p>
 
344
<p>See also <a href="q3header.html#moving-prop">setMovingEnabled</a>(), <a href="q3header.html#setClickEnabled">setClickEnabled</a>(), and <a href="q3header.html#tracking-prop">setTracking</a>().</p>
 
345
<h3 class="fn"><a name="setSortIndicator"></a>void Q3Header::setSortIndicator ( int <i>section</i>, <a href="qt.html#SortOrder-enum">Qt::SortOrder</a> <i>order</i> )</h3>
 
346
<p>Sets a sort indicator onto the specified <i>section</i>. The indicator's <i>order</i> is either Ascending or Descending.</p>
 
347
<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 <i>section</i> number of -1.</p>
 
348
<p>See also <a href="q3header.html#sortIndicatorSection">sortIndicatorSection</a>() and <a href="q3header.html#sortIndicatorOrder">sortIndicatorOrder</a>().</p>
 
349
<h3 class="fn"><a name="setSortIndicator-2"></a>void Q3Header::setSortIndicator ( int <i>section</i>, bool <i>ascending</i> = true )</h3>
 
350
<p>This is an overloaded member function, provided for convenience. It behaves essentially like the above function.</p>
 
351
<p>Sets the sort indicator to <i>ascending</i>. Use the other overload instead.</p>
 
352
<h3 class="fn"><a name="sizeChange"></a>void Q3Header::sizeChange ( int <i>section</i>, int <i>oldSize</i>, int <i>newSize</i> )&nbsp;&nbsp;<tt> [signal]</tt></h3>
 
353
<p>This signal is emitted when the user has changed the size of a <i>section</i> from <i>oldSize</i> to <i>newSize</i>. This signal is typically connected to a slot that repaints the table or list that contains the header.</p>
 
354
<h3 class="fn"><a name="sortIndicatorOrder"></a><a href="qt.html#SortOrder-enum">Qt::SortOrder</a> Q3Header::sortIndicatorOrder () const</h3>
 
355
<p>Returns the implied sort order of the Q3Headers sort indicator.</p>
 
356
<p>See also <a href="q3header.html#setSortIndicator">setSortIndicator</a>() and <a href="q3header.html#sortIndicatorSection">sortIndicatorSection</a>().</p>
 
357
<h3 class="fn"><a name="sortIndicatorSection"></a>int Q3Header::sortIndicatorSection () const</h3>
 
358
<p>Returns the section showing the sort indicator or -1 if there is no sort indicator.</p>
 
359
<p>See also <a href="q3header.html#setSortIndicator">setSortIndicator</a>() and <a href="q3header.html#sortIndicatorOrder">sortIndicatorOrder</a>().</p>
 
360
<p /><address><hr /><div align="center">
 
361
<table width="100%" cellspacing="0" border="0"><tr class="address">
 
362
<td width="30%">Copyright &copy; 2005 <a href="trolltech.html">Trolltech</a></td>
 
363
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
 
364
<td width="30%" align="right"><div align="right">Qt 4.0.0</div></td>
 
365
</tr></table></div></address></body>
 
366
</html>