You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
585 lines
26 KiB
585 lines
26 KiB
'\" 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).
|