Home | All Classes | Main Classes | Annotated | Grouped Classes | Functions | ![]() |
The QHeaderView class provides a header row or header column for item views. More...
#include <QHeaderView>
Inherits QAbstractItemView.
The QHeaderView class provides a header row or header column for item views.
A QHeaderView displays the headers used in item views such as the QTableView and QTreeView classes. It takes the place of the QHeader class previously used for the same purpose, but uses the Qt's model/view architecture for consistency with the item view classes.
Each header has an orientation() and a number of sections, given by the count() function. Sections can be moved and resized using moveSection() and resizeSection(); they can be hidden and shown with hideSection() and showSection().
Each section of a header is described by a section ID, specified by its section(), and can be located at a particular index() in the header. A section can have a sort indicator set with setSortIndicator(); this indicates whether the items in the associated item view will be sorted in the order given by the section.
A header can be fixed in place, or made movable with setMovable(). It can be made clickable with setClickable(), and has resizing behavior in accordance with setResizeMode().
A header emits sectionIndexChanged() if the user moves a section, sectionSizeChanged() if the user resizes a section, and sectionClicked() and sectionHandleDoubleClicked() in response to mouse clicks. A header also emits sectionCountChanged() and sectionAutoResize().
You can identify a section by its ID, using the section() and sectionAt() functions, or by its index position, using the index() and indexAt() functions. Note that the index can change if a section is moved.
See also Model/View Programming, QListView, QTableView, and QTreeView.
QHeaderView::Interactive | Don't automatically change the size (let the user do it manually). |
QHeaderView::Stretch | Fill all the available visible space. |
QHeaderView::Custom | Don't automatically change the size here, leave it to some other object. |
This property holds whether the current selection is highlighted.
Access functions:
Creates a new generic header with the given orientation and parent.
Destroys the header.
Returns the number of sections in the header.
Hides the specified section.
See also showSection().
Returns the horizontal offset of the header. This is 0 for vertical headers.
Reimplemented from QAbstractItemView.
See also offset().
Returns the index position of the given section.
See also section().
Returns the index of the section that covers the given position.
Returns true if the header is clickable; otherwise returns false. A clickable header could be set up to allow the user to change the representation of the data in the view related to the header.
See also setClickable().
Returns true if the header can be moved by the user; otherwise returns false.
See also setMovable().
Returns true if the section is hidden from the user; otherwise returns false.
Returns the model item index for the item in the given section.
Returns the number of the section at position (x, y) in contents coordinates..
Reimplemented from QAbstractItemView.
Moves the section at index position from to occupy index position to.
Returns the offset of the header: this is the header's left-most (or top-most for vertical headers) visible pixel.
See also setOffset().
Returns the orientation of the header.
See also Qt::Orientation.
Paints the section using the given painter with the option and model index.
You normally would not need to use this function.
Returns the resize mode that applies to the given section.
Returns the number of the section at the given index position.
See also index().
Returns the section that covers the given position.
This signal is emitted when a section is automatically resized. The section's number is specified by section, and the resize mode by mode.
This signal is emitted when a section is clicked. The section's number is specified by section, and the button by state.
This signal is emitted when the number of sections changes; i.e. when sections are added or deleted. The original count is specified by oldCount, and the new count by newCount.
This signal is emitted when a section is double-clicked. The section's number is specified by section, and the button by state.
This signal is emitted when a section is moved. The section's number is specified by section, the old index position by oldIndex, and the new index position by newIndex.
Returns the index position of the given section.
Returns the width (or height for vertical headers) of the given section.
This signal is emitted when a section is resized. The section's number is specified by section, the old size by oldSize, and the new size by newSize.
Returns a suitable size hint for the given section.
See also sizeHint().
This slot is called when sections are inserted into the parent model; first and last signify where the new sections are inserted. (first and last will be the same if just one section is inserted.)
This slot is called when sections are removed from the parent model; first and last signify where the sections are removed from. (first and last will be the same if just one section is removed.)
If clickable is true, the header will respond to single clicks.
See also isClickable().
If movable is true, the header may be moved by the user; otherwise it is fixed in place.
See also isMovable().
Sets the header's offset to offset.
See also offset().
Sets the constraints on how the header can be resized to those described by the given mode.
See also QLayout::ResizeMode.
This is an overloaded member function, provided for convenience. It behaves essentially like the above function.
Sets the constraints on how the section in the header can be resized to those described by the given mode.
See also QLayout::ResizeMode.
Selects the items in the given rect in accordance with the flags.
The base class implementation does nothing.
Reimplemented from QAbstractItemView.
Sets the sort indicator for the given section in the direction specified by order, and removes the sort indicator from any other section that was showing it.
See also sortIndicatorSection() and sortIndicatorOrder().
Shows the specified section.
See also hideSection().
Returns a suitable size hint for this header.
Reimplemented from QWidget.
See also sectionSizeHint().
Returns the order for the sort indicator. If no section has a sort indicator the return value of this function is undefined.
See also setSortIndicator() and sortIndicatorSection().
Returns the number of the section that has a sort indicator, or -1 if no section has a sort indicator.
See also setSortIndicator() and sortIndicatorOrder().
Returns the vertical offset of the header. This is 0 for horizontal headers.
Reimplemented from QAbstractItemView.
See also offset().
Copyright © 2004 Trolltech. | Trademarks | Qt 4.0.0-tp1 |