1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
|
'\" t
.TH QHeader 3qt "2 February 2007" "Trolltech AS" \" -*- nroff -*-
.\" Copyright 1992-2007 Trolltech ASA. All rights reserved. See the
.\" license file included in the distribution for a complete license
.\" statement.
.\"
.ad l
.nh
.SH NAME
QHeader \- Header row or column, e.g. for tables and listviews
.SH SYNOPSIS
\fC#include <qheader.h>\fR
.PP
Inherits QWidget.
.PP
.SS "Public Members"
.in +1c
.ti -1c
.BI "\fBQHeader\fR ( QWidget * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "\fBQHeader\fR ( int n, QWidget * parent = 0, const char * name = 0 )"
.br
.ti -1c
.BI "\fB~QHeader\fR ()"
.br
.ti -1c
.BI "int \fBaddLabel\fR ( const QString & s, int size = -1 )"
.br
.ti -1c
.BI "int \fBaddLabel\fR ( const QIconSet & iconset, const QString & s, int size = -1 )"
.br
.ti -1c
.BI "void \fBremoveLabel\fR ( int section )"
.br
.ti -1c
.BI "virtual void \fBsetLabel\fR ( int section, const QString & s, int size = -1 )"
.br
.ti -1c
.BI "virtual void \fBsetLabel\fR ( int section, const QIconSet & iconset, const QString & s, int size = -1 )"
.br
.ti -1c
.BI "QString \fBlabel\fR ( int section ) const"
.br
.ti -1c
.BI "QIconSet * \fBiconSet\fR ( int section ) const"
.br
.ti -1c
.BI "virtual void \fBsetOrientation\fR ( Orientation )"
.br
.ti -1c
.BI "Orientation \fBorientation\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetTracking\fR ( bool enable )"
.br
.ti -1c
.BI "bool \fBtracking\fR () const"
.br
.ti -1c
.BI "virtual void \fBsetClickEnabled\fR ( bool enable, int section = -1 )"
.br
.ti -1c
.BI "virtual void \fBsetResizeEnabled\fR ( bool enable, int section = -1 )"
.br
.ti -1c
.BI "virtual void \fBsetMovingEnabled\fR ( bool )"
.br
.ti -1c
.BI "virtual void \fBsetStretchEnabled\fR ( bool b, int section )"
.br
.ti -1c
.BI "void \fBsetStretchEnabled\fR ( bool b )"
.br
.ti -1c
.BI "bool \fBisClickEnabled\fR ( int section = -1 ) const"
.br
.ti -1c
.BI "bool \fBisResizeEnabled\fR ( int section = -1 ) const"
.br
.ti -1c
.BI "bool \fBisMovingEnabled\fR () const"
.br
.ti -1c
.BI "bool \fBisStretchEnabled\fR () const"
.br
.ti -1c
.BI "bool \fBisStretchEnabled\fR ( int section ) const"
.br
.ti -1c
.BI "void \fBresizeSection\fR ( int section, int s )"
.br
.ti -1c
.BI "int \fBsectionSize\fR ( int section ) const"
.br
.ti -1c
.BI "int \fBsectionPos\fR ( int section ) const"
.br
.ti -1c
.BI "int \fBsectionAt\fR ( int pos ) const"
.br
.ti -1c
.BI "int \fBcount\fR () const"
.br
.ti -1c
.BI "int \fBheaderWidth\fR () const"
.br
.ti -1c
.BI "QRect \fBsectionRect\fR ( int section ) const"
.br
.ti -1c
.BI "virtual void setCellSize ( int section, int s ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "int cellSize ( int i ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "int cellPos ( int i ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "int cellAt ( int pos ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "int \fBoffset\fR () const"
.br
.ti -1c
.BI "int \fBmapToSection\fR ( int index ) const"
.br
.ti -1c
.BI "int \fBmapToIndex\fR ( int section ) const"
.br
.ti -1c
.BI "int mapToLogical ( int a ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "int mapToActual ( int l ) const \fI(obsolete)\fR"
.br
.ti -1c
.BI "void \fBmoveSection\fR ( int section, int toIndex )"
.br
.ti -1c
.BI "virtual void moveCell ( int fromIdx, int toIdx ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "void setSortIndicator ( int section, bool ascending = TRUE ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "void \fBsetSortIndicator\fR ( int section, SortOrder order )"
.br
.ti -1c
.BI "int \fBsortIndicatorSection\fR () const"
.br
.ti -1c
.BI "SortOrder \fBsortIndicatorOrder\fR () const"
.br
.ti -1c
.BI "void \fBadjustHeaderSize\fR ()"
.br
.in -1c
.SS "Public Slots"
.in +1c
.ti -1c
.BI "virtual void \fBsetOffset\fR ( int pos )"
.br
.in -1c
.SS "Signals"
.in +1c
.ti -1c
.BI "void \fBclicked\fR ( int section )"
.br
.ti -1c
.BI "void \fBpressed\fR ( int section )"
.br
.ti -1c
.BI "void \fBreleased\fR ( int section )"
.br
.ti -1c
.BI "void \fBsizeChange\fR ( int section, int oldSize, int newSize )"
.br
.ti -1c
.BI "void \fBindexChange\fR ( int section, int fromIndex, int toIndex )"
.br
.ti -1c
.BI "void sectionClicked ( int index ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "void moved ( int fromIndex, int toIndex ) \fI(obsolete)\fR"
.br
.ti -1c
.BI "void \fBsectionHandleDoubleClicked\fR ( int section )"
.br
.in -1c
.SS "Properties"
.in +1c
.ti -1c
.BI "int \fBcount\fR - the number of sections in the header \fI(read " "only" ")\fR"
.br
.ti -1c
.BI "bool \fBmoving\fR - whether the header sections can be moved"
.br
.ti -1c
.BI "int \fBoffset\fR - the header's left-most (or top-most) visible pixel"
.br
.ti -1c
.BI "Orientation \fBorientation\fR - the header's orientation"
.br
.ti -1c
.BI "bool \fBstretching\fR - whether the header sections always take up the full width (or " "height" ") of the header"
.br
.ti -1c
.BI "bool \fBtracking\fR - whether the sizeChange() signal is emitted continuously"
.br
.in -1c
.SS "Protected Members"
.in +1c
.ti -1c
.BI "QRect \fBsRect\fR ( int index )"
.br
.ti -1c
.BI "virtual void \fBpaintSection\fR ( QPainter * p, int index, const QRect & fr )"
.br
.ti -1c
.BI "virtual void \fBpaintSectionLabel\fR ( QPainter * p, int index, const QRect & fr )"
.br
.in -1c
.SH DESCRIPTION
The QHeader class provides a header row or column, e.g. for tables and listviews.
.PP
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 QTable and QListView for example.
.PP
A header is composed of one or more \fIsections\fR, each of which can display a text label and an iconset. A sort indicator (an arrow) can also be displayed using setSortIndicator().
.PP
Sections are added with addLabel() and removed with removeLabel(). The label and iconset are set in addLabel() and can be changed later with setLabel(). Use count() to retrieve the number of sections in the header.
.PP
The orientation of the header is set with setOrientation(). If setStretchEnabled() 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 setResizeEnabled() is TRUE. Call adjustHeaderSize() to have the sections resize to occupy the full width (or height).
.PP
A section can be moved with moveSection(). If setMovingEnabled() 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 addLabel()), 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.
.PP
If you want the current index position of a section call mapToIndex() 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 mapToSection() giving it the index number.
.PP
Here's an example to clarify mapToSection() and mapToIndex():
.PP
<center>.nf
.TS
l - l. Index positions 0 1 2 3 Original section ordering Sect 0 Sect 1 Sect 2 Sect 3 Ordering after the user moves a section Sect 0 Sect 2 Sect 3
.TE
.fi
</center>
.PP
<center>.nf
.TS
l - l. \fIk\fR mapToSection(\fIk\fR) mapToIndex(\fIk\fR) 0 0 0 1 2 3 2 3 1 3 1
.TE
.fi
</center>
.PP
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.
.PP
QHeader provides the clicked(), pressed() and released() signals. If the user changes the size of a section, the sizeChange() 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 setTracking(). If the user moves a section the indexChange() signal is emitted.
.PP
.ce 1
.B "[Image Omitted]"
.PP
.ce 1
.B "[Image Omitted]"
.PP
See also QListView, QTable, and Advanced Widgets.
.SH MEMBER FUNCTION DOCUMENTATION
.SH "QHeader::QHeader ( QWidget * parent = 0, const char * name = 0 )"
Constructs a horizontal header called \fIname\fR, with parent \fIparent\fR.
.SH "QHeader::QHeader ( int n, QWidget * parent = 0, const char * name = 0 )"
Constructs a horizontal header called \fIname\fR, with \fIn\fR sections and parent \fIparent\fR.
.SH "QHeader::~QHeader ()"
Destroys the header and all its sections.
.SH "int QHeader::addLabel ( const QString & s, int size = -1 )"
Adds a new section with label text \fIs\fR. 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 \fIsize\fR. If \fIsize\fR < 0, an appropriate size for the text \fIs\fR is chosen.
.SH "int QHeader::addLabel ( const QIconSet & iconset, const QString & s, int size = -1 )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Adds a new section with iconset \fIiconset\fR and label text \fIs\fR. 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 \fIsize\fR, unless size is negative in which case the size is calculated taking account of the size of the text.
.SH "void QHeader::adjustHeaderSize ()"
Adjusts the size of the sections to fit the size of the header as completely as possible. Only sections for which isStretchEnabled() is TRUE will be resized.
.SH "int QHeader::cellAt ( int pos ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Use sectionAt() instead.
.PP
Returns the index at which the section is displayed, which contains \fIpos\fR in widget coordinates, or -1 if \fIpos\fR is outside the header sections.
.SH "int QHeader::cellPos ( int i ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Use sectionPos() instead.
.PP
Returns the position in pixels of the section that is displayed at the index \fIi\fR. The position is measured from the start of the header.
.SH "int QHeader::cellSize ( int i ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Use sectionSize() instead.
.PP
Returns the size in pixels of the section that is displayed at the index \fIi\fR.
.SH "void QHeader::clicked ( int section )\fC [signal]\fR"
If isClickEnabled() is TRUE, this signal is emitted when the user clicks section \fIsection\fR.
.PP
See also pressed() and released().
.SH "int QHeader::count () const"
Returns the number of sections in the header. See the "count" property for details.
.SH "int QHeader::headerWidth () const"
Returns the total width of all the header columns.
.SH "QIconSet * QHeader::iconSet ( int section ) const"
Returns the icon set for section \fIsection\fR. If the section does not exist, 0 is returned.
.SH "void QHeader::indexChange ( int section, int fromIndex, int toIndex )\fC [signal]\fR"
This signal is emitted when the user moves section \fIsection\fR from index position \fIfromIndex\fR, to index position \fItoIndex\fR.
.SH "bool QHeader::isClickEnabled ( int section = -1 ) const"
Returns TRUE if section \fIsection\fR is clickable; otherwise returns FALSE.
.PP
If \fIsection\fR is out of range (negative or larger than count() - 1): returns TRUE if all sections are clickable; otherwise returns FALSE.
.PP
See also setClickEnabled().
.SH "bool QHeader::isMovingEnabled () const"
Returns TRUE if the header sections can be moved; otherwise returns FALSE. See the "moving" property for details.
.SH "bool QHeader::isResizeEnabled ( int section = -1 ) const"
Returns TRUE if section \fIsection\fR is resizeable; otherwise returns FALSE.
.PP
If \fIsection\fR is -1 then this function applies to all sections, i.e. returns TRUE if all sections are resizeable; otherwise returns FALSE.
.PP
See also setResizeEnabled().
.SH "bool QHeader::isStretchEnabled () const"
Returns TRUE if the header sections always take up the full width (or height) of the header; otherwise returns FALSE. See the "stretching" property for details.
.SH "bool QHeader::isStretchEnabled ( int section ) const"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Returns TRUE if section \fIsection\fR 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.
.PP
See also setStretchEnabled().
.SH "QString QHeader::label ( int section ) const"
Returns the text for section \fIsection\fR. If the section does not exist, a QString::null is returned.
.PP
Example: helpsystem/tooltip.cpp.
.SH "int QHeader::mapToActual ( int l ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Use mapToIndex() instead.
.PP
Translates from logical index \fIl\fR to actual index (index at which the section \fIl\fR is displayed) . Returns -1 if \fIl\fR is outside the legal range.
.PP
See also mapToLogical().
.SH "int QHeader::mapToIndex ( int section ) const"
Returns the index position corresponding to the specified \fIsection\fR number.
.PP
\fBWarning:\fR If QTable 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 moveSection() to move sections but handles move operations internally.
.PP
See also mapToSection().
.SH "int QHeader::mapToLogical ( int a ) const"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Use mapToSection() instead.
.PP
Translates from actual index \fIa\fR (index at which the section is displayed) to logical index of the section. Returns -1 if \fIa\fR is outside the legal range.
.PP
See also mapToActual().
.SH "int QHeader::mapToSection ( int index ) const"
Returns the number of the section that corresponds to the specified \fIindex\fR.
.PP
\fBWarning:\fR If QTable 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 moveSection() to move sections but handles move operations internally.
.PP
See also mapToIndex().
.SH "void QHeader::moveCell ( int fromIdx, int toIdx )\fC [virtual]\fR"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Use moveSection() instead.
.PP
Moves the section that is currently displayed at index \fIfromIdx\fR to index \fItoIdx\fR.
.SH "void QHeader::moveSection ( int section, int toIndex )"
Moves section \fIsection\fR to index position \fItoIndex\fR.
.SH "void QHeader::moved ( int fromIndex, int toIndex )\fC [signal]\fR"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Use indexChange() instead.
.PP
This signal is emitted when the user has moved the section which is displayed at the index \fIfromIndex\fR to the index \fItoIndex\fR.
.SH "int QHeader::offset () const"
Returns the header's left-most (or top-most) visible pixel. See the "offset" property for details.
.SH "Orientation QHeader::orientation () const"
Returns the header's orientation. See the "orientation" property for details.
.SH "void QHeader::paintSection ( QPainter * p, int index, const QRect & fr )\fC [virtual protected]\fR"
Paints the section at position \fIindex\fR, inside rectangle \fIfr\fR (which uses widget coordinates) using painter \fIp\fR.
.PP
Calls paintSectionLabel().
.SH "void QHeader::paintSectionLabel ( QPainter * p, int index, const QRect & fr )\fC [virtual protected]\fR"
Paints the label of the section at position \fIindex\fR, inside rectangle \fIfr\fR (which uses widget coordinates) using painter \fIp\fR.
.PP
Called by paintSection()
.SH "void QHeader::pressed ( int section )\fC [signal]\fR"
This signal is emitted when the user presses section \fIsection\fR down.
.PP
See also released().
.SH "void QHeader::released ( int section )\fC [signal]\fR"
This signal is emitted when section \fIsection\fR is released.
.PP
See also pressed().
.SH "void QHeader::removeLabel ( int section )"
Removes section \fIsection\fR. If the section does not exist, nothing happens.
.SH "void QHeader::resizeSection ( int section, int s )"
Resizes section \fIsection\fR to \fIs\fR pixels wide (or high).
.SH "QRect QHeader::sRect ( int index )\fC [protected]\fR"
Returns the rectangle covered by the section at index \fIindex\fR.
.SH "int QHeader::sectionAt ( int pos ) const"
Returns the index of the section which contains the position \fIpos\fR given in pixels from the left (or top).
.PP
See also offset.
.PP
Example: helpsystem/tooltip.cpp.
.SH "void QHeader::sectionClicked ( int index )\fC [signal]\fR"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Use clicked() instead.
.PP
This signal is emitted when a part of the header is clicked. \fIindex\fR is the index at which the section is displayed.
.PP
In a list view this signal would typically be connected to a slot that sorts the specified column (or row).
.SH "void QHeader::sectionHandleDoubleClicked ( int section )\fC [signal]\fR"
This signal is emitted when the user doubleclicks on the edge (handle) of section \fIsection\fR.
.SH "int QHeader::sectionPos ( int section ) const"
Returns the position (in pixels) at which the \fIsection\fR starts.
.PP
See also offset.
.SH "QRect QHeader::sectionRect ( int section ) const"
Returns the rectangle covered by section \fIsection\fR.
.PP
Example: helpsystem/tooltip.cpp.
.SH "int QHeader::sectionSize ( int section ) const"
Returns the width (or height) of the \fIsection\fR in pixels.
.SH "void QHeader::setCellSize ( int section, int s )\fC [virtual]\fR"
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Use resizeSection() instead.
.PP
Sets the size of the section \fIsection\fR to \fIs\fR pixels.
.PP
\fBWarning:\fR does not repaint or send out signals
.SH "void QHeader::setClickEnabled ( bool enable, int section = -1 )\fC [virtual]\fR"
If \fIenable\fR is TRUE, any clicks on section \fIsection\fR will result in clicked() signals being emitted; otherwise the section will ignore clicks.
.PP
If \fIsection\fR is -1 (the default) then the \fIenable\fR value is set for all existing sections and will be applied to any new sections that are added.
.PP
See also moving and setResizeEnabled().
.SH "void QHeader::setLabel ( int section, const QString & s, int size = -1 )\fC [virtual]\fR"
Sets the text of section \fIsection\fR to \fIs\fR. The section's width is set to \fIsize\fR if \fIsize\fR >= 0; otherwise it is left unchanged. Any icon set that has been set for this section remains unchanged.
.PP
If the section does not exist, nothing happens.
.PP
Examples:
.)l chart/setdataform.cpp and table/small-table-demo/main.cpp.
.SH "void QHeader::setLabel ( int section, const QIconSet & iconset, const QString & s, int size = -1 )\fC [virtual]\fR"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
Sets the icon for section \fIsection\fR to \fIiconset\fR and the text to \fIs\fR. The section's width is set to \fIsize\fR if \fIsize\fR >= 0; otherwise it is left unchanged.
.PP
If the section does not exist, nothing happens.
.SH "void QHeader::setMovingEnabled ( bool )\fC [virtual]\fR"
Sets whether the header sections can be moved. See the "moving" property for details.
.SH "void QHeader::setOffset ( int pos )\fC [virtual slot]\fR"
Sets the header's left-most (or top-most) visible pixel to \fIpos\fR. See the "offset" property for details.
.SH "void QHeader::setOrientation ( Orientation )\fC [virtual]\fR"
Sets the header's orientation. See the "orientation" property for details.
.SH "void QHeader::setResizeEnabled ( bool enable, int section = -1 )\fC [virtual]\fR"
If \fIenable\fR is TRUE the user may resize section \fIsection\fR; otherwise the section may not be manually resized.
.PP
If \fIsection\fR is negative (the default) then the \fIenable\fR value is set for all existing sections and will be applied to any new sections that are added. Example:
.PP
.nf
.br
// Allow resizing of all current and future sections
.br
header->setResizeEnabled(TRUE);
.br
// Disable resizing of section 3, (the fourth section added)
.br
header->setResizeEnabled(FALSE, 3);
.br
.fi
.PP
If the user resizes a section, a sizeChange() signal is emitted.
.PP
See also moving, setClickEnabled(), and tracking.
.SH "void QHeader::setSortIndicator ( int section, SortOrder order )"
Sets a sort indicator onto the specified \fIsection\fR. The indicator's \fIorder\fR is either Ascending or Descending.
.PP
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 \fIsection\fR number of -1.
.PP
See also sortIndicatorSection() and sortIndicatorOrder().
.SH "void QHeader::setSortIndicator ( int section, bool ascending = TRUE )"
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
.PP
\fBThis function is obsolete.\fR It is provided to keep old source working. We strongly advise against using it in new code.
.PP
Use the other overload instead.
.SH "void QHeader::setStretchEnabled ( bool b, int section )\fC [virtual]\fR"
If \fIb\fR is TRUE, section \fIsection\fR 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 \fIsection\fR will be set to be unstretchable and will not resize when the header is resized.
.PP
If \fIsection\fR is -1, and if \fIb\fR 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.
.PP
See also adjustHeaderSize().
.SH "void QHeader::setStretchEnabled ( bool b )"
Sets whether the header sections always take up the full width (or height) of the header to \fIb\fR. See the "stretching" property for details.
.SH "void QHeader::setTracking ( bool enable )\fC [virtual]\fR"
Sets whether the sizeChange() signal is emitted continuously to \fIenable\fR. See the "tracking" property for details.
.SH "void QHeader::sizeChange ( int section, int oldSize, int newSize )\fC [signal]\fR"
This signal is emitted when the user has changed the size of a \fIsection\fR from \fIoldSize\fR to \fInewSize\fR. This signal is typically connected to a slot that repaints the table or list that contains the header.
.SH "SortOrder QHeader::sortIndicatorOrder () const"
Returns the implied sort order of the QHeaders sort indicator.
.PP
See also setSortIndicator() and sortIndicatorSection().
.SH "int QHeader::sortIndicatorSection () const"
Returns the section showing the sort indicator or -1 if there is no sort indicator.
.PP
See also setSortIndicator() and sortIndicatorOrder().
.SH "bool QHeader::tracking () const"
Returns TRUE if the sizeChange() signal is emitted continuously; otherwise returns FALSE. See the "tracking" property for details.
.SS "Property Documentation"
.SH "int count"
This property holds the number of sections in the header.
.PP
Get this property's value with count().
.SH "bool moving"
This property holds whether the header sections can be moved.
.PP
If this property is TRUE (the default) the user can move sections. If the user moves a section the indexChange() signal is emitted.
.PP
See also setClickEnabled() and setResizeEnabled().
.PP
Set this property's value with setMovingEnabled() and get this property's value with isMovingEnabled().
.SH "int offset"
This property holds the header's left-most (or top-most) visible pixel.
.PP
Setting this property will scroll the header so that \fIoffset\fR becomes the left-most (or top-most for vertical headers) visible pixel.
.PP
Set this property's value with setOffset() and get this property's value with offset().
.SH "Orientation orientation"
This property holds the header's orientation.
.PP
The orientation is either Vertical or Horizontal (the default).
.PP
Call setOrientation() before adding labels if you don't provide a size parameter otherwise the sizes will be incorrect.
.PP
Set this property's value with setOrientation() and get this property's value with orientation().
.SH "bool stretching"
This property holds whether the header sections always take up the full width (or height) of the header.
.PP
Set this property's value with setStretchEnabled() and get this property's value with isStretchEnabled().
.SH "bool tracking"
This property holds whether the sizeChange() signal is emitted continuously.
.PP
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.
.PP
Tracking defaults to FALSE.
.PP
Set this property's value with setTracking() and get this property's value with tracking().
.SH "SEE ALSO"
.BR http://doc.trolltech.com/qheader.html
.BR http://www.trolltech.com/faq/tech.html
.SH COPYRIGHT
Copyright 1992-2007 Trolltech ASA, http://www.trolltech.com. See the
license file included in the distribution for a complete license
statement.
.SH AUTHOR
Generated automatically from the source code.
.SH BUGS
If you find a bug in Qt, please report it as described in
.BR http://doc.trolltech.com/bughowto.html .
Good bug reports help us to help you. Thank you.
.P
The definitive Qt documentation is provided in HTML format; it is
located at $QTDIR/doc/html and can be read using Qt Assistant or with
a web browser. This man page is provided as a convenience for those
users who prefer man pages, although this format is not officially
supported by Trolltech.
.P
If you find errors in this manual page, please report them to
.BR qt-bugs@trolltech.com .
Please include the name of the manual page (qheader.3qt) and the Qt
version (3.3.8).
|