Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
|
The QHeaderView class provides a header row or header column for item views. More...
#include <qheaderview.h>
Public Types | |
enum | ResizeMode { Interactive , Stretch , Fixed , ResizeToContents , Custom = Fixed } |
The resize mode specifies the behavior of the header sections. More... | |
Public Types inherited from QAbstractItemView | |
enum | SelectionMode { NoSelection , SingleSelection , MultiSelection , ExtendedSelection , ContiguousSelection } |
This enum indicates how the view responds to user selections: More... | |
enum | SelectionBehavior { SelectItems , SelectRows , SelectColumns } |
\value SelectItems Selecting single items. More... | |
enum | ScrollHint { EnsureVisible , PositionAtTop , PositionAtBottom , PositionAtCenter } |
\value EnsureVisible Scroll to ensure that the item is visible. More... | |
enum | EditTrigger { NoEditTriggers = 0 , CurrentChanged = 1 , DoubleClicked = 2 , SelectedClicked = 4 , EditKeyPressed = 8 , AnyKeyPressed = 16 , AllEditTriggers = 31 } |
This enum describes actions which will initiate item editing. More... | |
enum | ScrollMode { ScrollPerItem , ScrollPerPixel } |
Public Slots | |
void | setOffset (int offset) |
Sets the header's offset to offset. | |
void | setOffsetToSectionPosition (int visualIndex) |
void | setOffsetToLastSection () |
void | headerDataChanged (Qt::Orientation orientation, int logicalFirst, int logicalLast) |
Updates the changed header sections with the given orientation, from logicalFirst to logicalLast inclusive. | |
Public Slots inherited from QAbstractItemView | |
virtual void | setRootIndex (const QModelIndex &index) |
Sets the root item to the item at the given index. | |
virtual void | selectAll () |
Selects all items in the view. | |
void | edit (const QModelIndex &index) |
Starts editing the item corresponding to the given index if it is editable. | |
void | clearSelection () |
Deselects all selected items. | |
void | setCurrentIndex (const QModelIndex &index) |
Sets the current item to be the item at index. | |
void | scrollToTop () |
void | scrollToBottom () |
void | update (const QModelIndex &index) |
Signals | |
void | sectionMoved (int logicalIndex, int oldVisualIndex, int newVisualIndex) |
This signal is emitted when a section is moved. | |
void | sectionResized (int logicalIndex, int oldSize, int newSize) |
This signal is emitted when a section is resized. | |
void | sectionPressed (int logicalIndex) |
This signal is emitted when a section is pressed. | |
void | sectionClicked (int logicalIndex) |
This signal is emitted when a section is clicked. | |
void | sectionEntered (int logicalIndex) |
void | sectionDoubleClicked (int logicalIndex) |
This signal is emitted when a section is double-clicked. | |
void | sectionCountChanged (int oldCount, int newCount) |
This signal is emitted when the number of sections changes, i.e., when sections are added or deleted. | |
void | sectionHandleDoubleClicked (int logicalIndex) |
This signal is emitted when a section is double-clicked. | |
void | geometriesChanged () |
void | sortIndicatorChanged (int logicalIndex, Qt::SortOrder order) |
void | sortIndicatorClearableChanged (bool clearable) |
Signals inherited from QAbstractItemView | |
void | pressed (const QModelIndex &index) |
This signal is emitted when a mouse button is pressed. | |
void | clicked (const QModelIndex &index) |
This signal is emitted when a mouse button is left-clicked. | |
void | doubleClicked (const QModelIndex &index) |
This signal is emitted when a mouse button is double-clicked. | |
void | activated (const QModelIndex &index) |
This signal is emitted when the item specified by index is activated by the user. | |
void | entered (const QModelIndex &index) |
This signal is emitted when the mouse cursor enters the item specified by index. | |
void | viewportEntered () |
This signal is emitted when the mouse cursor enters the viewport. | |
void | iconSizeChanged (const QSize &size) |
Public Member Functions | |
QHeaderView (Qt::Orientation orientation, QWidget *parent=nullptr) | |
Creates a new generic header with the given orientation and parent. | |
virtual | ~QHeaderView () |
Destroys the header. | |
void | setModel (QAbstractItemModel *model) override |
\reimp | |
Qt::Orientation | orientation () const |
Returns the orientation of the header. | |
int | offset () const |
Returns the offset of the header: this is the header's left-most (or top-most for vertical headers) visible pixel. | |
int | length () const |
Returns the length along the orientation of the header. | |
QSize | sizeHint () const override |
Returns a suitable size hint for this header. | |
void | setVisible (bool v) override |
\reimp | |
int | sectionSizeHint (int logicalIndex) const |
Returns a suitable size hint for the section specified by logicalIndex. | |
int | visualIndexAt (int position) const |
Returns the visual index of the section that covers the given position in the viewport. | |
int | logicalIndexAt (int position) const |
Returns the section that covers the given position in the viewport. | |
int | logicalIndexAt (int x, int y) const |
Returns the logical index of the section at the given coordinate. | |
int | logicalIndexAt (const QPoint &pos) const |
Returns the logical index of the section at the position given in pos. | |
int | sectionSize (int logicalIndex) const |
Returns the width (or height for vertical headers) of the given logicalIndex. | |
int | sectionPosition (int logicalIndex) const |
Returns the section position of the given logicalIndex, or -1 if the section is hidden. | |
int | sectionViewportPosition (int logicalIndex) const |
Returns the section viewport position of the given logicalIndex. | |
void | moveSection (int from, int to) |
Moves the section at visual index from to occupy visual index to. | |
void | swapSections (int first, int second) |
void | resizeSection (int logicalIndex, int size) |
Resizes the section specified by logicalIndex to size measured in pixels. | |
void | resizeSections (QHeaderView::ResizeMode mode) |
Resizes the sections according to the given mode, ignoring the current resize mode. | |
bool | isSectionHidden (int logicalIndex) const |
Returns true if the section specified by logicalIndex is explicitly hidden from the user; otherwise returns false . | |
void | setSectionHidden (int logicalIndex, bool hide) |
If hide is true the section specified by logicalIndex is hidden; otherwise the section is shown. | |
int | hiddenSectionCount () const |
void | hideSection (int logicalIndex) |
Hides the section specified by logicalIndex. | |
void | showSection (int logicalIndex) |
Shows the section specified by logicalIndex. | |
int | count () const |
Returns the number of sections in the header. | |
int | visualIndex (int logicalIndex) const |
Returns the visual index position of the section specified by the given logicalIndex, or -1 otherwise. | |
int | logicalIndex (int visualIndex) const |
Returns the logicalIndex for the section at the given visualIndex position, or -1 if visualIndex < 0 or visualIndex >= QHeaderView::count(). | |
void | setSectionsMovable (bool movable) |
Sets \l sectionsMovable to movable. | |
bool | sectionsMovable () const |
Returns \l sectionsMovable. | |
void | setFirstSectionMovable (bool movable) |
bool | isFirstSectionMovable () const |
void | setSectionsClickable (bool clickable) |
Set \l sectionsClickable to clickable. | |
bool | sectionsClickable () const |
Returns \l sectionsClickable. | |
void | setHighlightSections (bool highlight) |
bool | highlightSections () const |
ResizeMode | sectionResizeMode (int logicalIndex) const |
void | setSectionResizeMode (ResizeMode mode) |
void | setSectionResizeMode (int logicalIndex, ResizeMode mode) |
void | setResizeContentsPrecision (int precision) |
int | resizeContentsPrecision () const |
int | stretchSectionCount () const |
void | setSortIndicatorShown (bool show) |
bool | isSortIndicatorShown () const |
void | setSortIndicator (int logicalIndex, Qt::SortOrder order) |
Sets the sort indicator for the section specified by the given logicalIndex in the direction specified by order, and removes the sort indicator from any other section that was showing it. | |
int | sortIndicatorSection () const |
Returns the logical index of the section that has a sort indicator. | |
Qt::SortOrder | sortIndicatorOrder () const |
Returns the order for the sort indicator. | |
void | setSortIndicatorClearable (bool clearable) |
bool | isSortIndicatorClearable () const |
bool | stretchLastSection () const |
void | setStretchLastSection (bool stretch) |
bool | cascadingSectionResizes () const |
void | setCascadingSectionResizes (bool enable) |
int | defaultSectionSize () const |
void | setDefaultSectionSize (int size) |
void | resetDefaultSectionSize () |
int | minimumSectionSize () const |
void | setMinimumSectionSize (int size) |
int | maximumSectionSize () const |
void | setMaximumSectionSize (int size) |
Qt::Alignment | defaultAlignment () const |
void | setDefaultAlignment (Qt::Alignment alignment) |
void | doItemsLayout () override |
bool | sectionsMoved () const |
Returns true if sections in the header has been moved; otherwise returns false;. | |
bool | sectionsHidden () const |
QByteArray | saveState () const |
bool | restoreState (const QByteArray &state) |
void | reset () override |
\reimp | |
Public Member Functions inherited from QAbstractItemView | |
QAbstractItemView (QWidget *parent=nullptr) | |
Constructs an abstract item view with the given parent. | |
~QAbstractItemView () | |
Destroys the view. | |
QAbstractItemModel * | model () const |
Returns the model that this view is presenting. | |
virtual void | setSelectionModel (QItemSelectionModel *selectionModel) |
Sets the current selection model to the given selectionModel. | |
QItemSelectionModel * | selectionModel () const |
Returns the current selection model. | |
void | setItemDelegate (QAbstractItemDelegate *delegate) |
Sets the item delegate for this view and its model to delegate. | |
QAbstractItemDelegate * | itemDelegate () const |
Returns the item delegate used by this view and model. | |
void | setSelectionMode (QAbstractItemView::SelectionMode mode) |
QAbstractItemView::SelectionMode | selectionMode () const |
void | setSelectionBehavior (QAbstractItemView::SelectionBehavior behavior) |
QAbstractItemView::SelectionBehavior | selectionBehavior () const |
QModelIndex | currentIndex () const |
Returns the model index of the current item. | |
QModelIndex | rootIndex () const |
Returns the model index of the model's root item. | |
void | setEditTriggers (EditTriggers triggers) |
EditTriggers | editTriggers () const |
void | setVerticalScrollMode (ScrollMode mode) |
ScrollMode | verticalScrollMode () const |
void | resetVerticalScrollMode () |
void | setHorizontalScrollMode (ScrollMode mode) |
ScrollMode | horizontalScrollMode () const |
void | resetHorizontalScrollMode () |
void | setAutoScroll (bool enable) |
bool | hasAutoScroll () const |
void | setAutoScrollMargin (int margin) |
int | autoScrollMargin () const |
void | setTabKeyNavigation (bool enable) |
bool | tabKeyNavigation () const |
void | setAlternatingRowColors (bool enable) |
bool | alternatingRowColors () const |
void | setIconSize (const QSize &size) |
QSize | iconSize () const |
void | setTextElideMode (Qt::TextElideMode mode) |
Qt::TextElideMode | textElideMode () const |
virtual void | keyboardSearch (const QString &search) |
Moves to and selects the item best matching the string search. | |
QSize | sizeHintForIndex (const QModelIndex &index) const |
Returns the size hint for the item with the specified index or an invalid size for invalid indexes. | |
virtual int | sizeHintForRow (int row) const |
Returns the height size hint for the specified row or -1 if there is no model. | |
virtual int | sizeHintForColumn (int column) const |
Returns the width size hint for the specified column or -1 if there is no model. | |
void | openPersistentEditor (const QModelIndex &index) |
Opens a persistent editor on the item at the given index. | |
void | closePersistentEditor (const QModelIndex &index) |
Closes the persistent editor for the item at the given index. | |
bool | isPersistentEditorOpen (const QModelIndex &index) const |
void | setIndexWidget (const QModelIndex &index, QWidget *widget) |
QWidget * | indexWidget (const QModelIndex &index) const |
void | setItemDelegateForRow (int row, QAbstractItemDelegate *delegate) |
QAbstractItemDelegate * | itemDelegateForRow (int row) const |
void | setItemDelegateForColumn (int column, QAbstractItemDelegate *delegate) |
QAbstractItemDelegate * | itemDelegateForColumn (int column) const |
virtual QAbstractItemDelegate * | itemDelegateForIndex (const QModelIndex &index) const |
virtual QVariant | inputMethodQuery (Qt::InputMethodQuery query) const override |
\reimp | |
Protected Slots | |
void | updateSection (int logicalIndex) |
void | resizeSections () |
Resizes the sections according to their size hints. | |
void | sectionsInserted (const QModelIndex &parent, int logicalFirst, int logicalLast) |
This slot is called when sections are inserted into the parent. | |
void | sectionsAboutToBeRemoved (const QModelIndex &parent, int logicalFirst, int logicalLast) |
This slot is called when sections are removed from the parent. | |
Protected Slots inherited from QAbstractItemView | |
virtual void | rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end) |
This slot is called when rows are about to be removed. | |
virtual void | selectionChanged (const QItemSelection &selected, const QItemSelection &deselected) |
This slot is called when the selection is changed. | |
virtual void | updateEditorData () |
virtual void | updateEditorGeometries () |
virtual void | verticalScrollbarAction (int action) |
virtual void | horizontalScrollbarAction (int action) |
virtual void | verticalScrollbarValueChanged (int value) |
virtual void | horizontalScrollbarValueChanged (int value) |
virtual void | closeEditor (QWidget *editor, QAbstractItemDelegate::EndEditHint hint) |
Closes the given editor, and releases it. | |
virtual void | commitData (QWidget *editor) |
Commit the data in the editor to the model. | |
virtual void | editorDestroyed (QObject *editor) |
This function is called when the given editor has been destroyed. | |
Protected Member Functions | |
QHeaderView (QHeaderViewPrivate &dd, Qt::Orientation orientation, QWidget *parent=nullptr) | |
void | initialize () |
void | initializeSections () |
void | initializeSections (int start, int end) |
void | currentChanged (const QModelIndex ¤t, const QModelIndex &old) override |
\reimp | |
bool | event (QEvent *e) override |
\reimp | |
void | paintEvent (QPaintEvent *e) override |
\reimp | |
void | mousePressEvent (QMouseEvent *e) override |
\reimp | |
void | mouseMoveEvent (QMouseEvent *e) override |
\reimp | |
void | mouseReleaseEvent (QMouseEvent *e) override |
\reimp | |
void | mouseDoubleClickEvent (QMouseEvent *e) override |
\reimp | |
bool | viewportEvent (QEvent *e) override |
\reimp | |
virtual void | paintSection (QPainter *painter, const QRect &rect, int logicalIndex) const |
Paints the section specified by the given logicalIndex, using the given painter and rect. | |
virtual QSize | sectionSizeFromContents (int logicalIndex) const |
Returns the size of the contents of the section specified by the given logicalIndex. | |
int | horizontalOffset () const override |
Returns the horizontal offset of the header. | |
int | verticalOffset () const override |
Returns the vertical offset of the header. | |
void | updateGeometries () override |
\reimp | |
void | scrollContentsBy (int dx, int dy) override |
\reimp | |
void | dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles=QList< int >()) override |
\reimp | |
void | rowsInserted (const QModelIndex &parent, int start, int end) override |
\reimp | |
QRect | visualRect (const QModelIndex &index) const override |
\reimp | |
void | scrollTo (const QModelIndex &index, ScrollHint hint) override |
\reimp | |
QModelIndex | indexAt (const QPoint &p) const override |
\reimp | |
bool | isIndexHidden (const QModelIndex &index) const override |
\reimp | |
QModelIndex | moveCursor (CursorAction, Qt::KeyboardModifiers) override |
\reimp | |
void | setSelection (const QRect &rect, QItemSelectionModel::SelectionFlags flags) override |
\reimp | |
QRegion | visualRegionForSelection (const QItemSelection &selection) const override |
virtual void | initStyleOptionForIndex (QStyleOptionHeader *option, int logicalIndex) const |
virtual void | initStyleOption (QStyleOptionHeader *option) const |
Initialize option with the values from this QHeaderView. | |
Protected Member Functions inherited from QAbstractItemView | |
QAbstractItemView (QAbstractItemViewPrivate &, QWidget *parent=nullptr) | |
virtual QModelIndexList | selectedIndexes () const |
This convenience function returns a list of all selected and non-hidden item indexes in the view. | |
virtual bool | edit (const QModelIndex &index, EditTrigger trigger, QEvent *event) |
Starts editing the item at index, creating an editor if necessary, and returns true if the view's \l{State} is now EditingState; otherwise returns false . | |
virtual QItemSelectionModel::SelectionFlags | selectionCommand (const QModelIndex &index, const QEvent *event=nullptr) const |
Returns the SelectionFlags to be used when updating a selection model for the specified index. | |
virtual void | initViewItemOption (QStyleOptionViewItem *option) const |
State | state () const |
Returns the item view's state. | |
void | setState (State state) |
Sets the item view's state to the given state. | |
void | scheduleDelayedItemsLayout () |
Schedules a layout of the items in the view to be executed when the event processing starts. | |
void | executeDelayedItemsLayout () |
Executes the scheduled layouts without waiting for the event processing to begin. | |
void | setDirtyRegion (const QRegion ®ion) |
void | scrollDirtyRegion (int dx, int dy) |
Prepares the view for scrolling by ({dx},{dy}) pixels by moving the dirty regions in the opposite direction. | |
QPoint | dirtyRegionOffset () const |
Returns the offset of the dirty regions in the view. | |
void | startAutoScroll () |
void | stopAutoScroll () |
void | doAutoScroll () |
bool | focusNextPrevChild (bool next) override |
\reimp | |
bool | event (QEvent *event) override |
\reimp | |
bool | viewportEvent (QEvent *event) override |
This function is used to handle tool tips, and What's This? mode, if the given event is a QEvent::ToolTip,or a QEvent::WhatsThis. | |
void | mousePressEvent (QMouseEvent *event) override |
This function is called with the given event when a mouse button is pressed while the cursor is inside the widget. | |
void | mouseMoveEvent (QMouseEvent *event) override |
This function is called with the given event when a mouse move event is sent to the widget. | |
void | mouseReleaseEvent (QMouseEvent *event) override |
This function is called with the given event when a mouse button is released, after a mouse press event on the widget. | |
void | mouseDoubleClickEvent (QMouseEvent *event) override |
This function is called with the given event when a mouse button is double clicked inside the widget. | |
void | focusInEvent (QFocusEvent *event) override |
This function is called with the given event when the widget obtains the focus. | |
void | focusOutEvent (QFocusEvent *event) override |
This function is called with the given event when the widget loses the focus. | |
void | keyPressEvent (QKeyEvent *event) override |
This function is called with the given event when a key event is sent to the widget. | |
void | resizeEvent (QResizeEvent *event) override |
This function is called with the given event when a resize event is sent to the widget. | |
void | timerEvent (QTimerEvent *event) override |
This function is called with the given event when a timer event is sent to the widget. | |
void | inputMethodEvent (QInputMethodEvent *event) override |
\reimp | |
bool | eventFilter (QObject *object, QEvent *event) override |
\reimp | |
QSize | viewportSizeHint () const override |
Properties | |
bool | firstSectionMovable |
Whether the first column can be moved by the user. | |
bool | showSortIndicator |
whether the sort indicator is shown | |
bool | sectionsMovable |
If sectionsMovable is true, the header sections may be moved by the user; otherwise they are fixed in place. | |
bool | sectionsClickable |
Holds true if the header is clickable; otherwise false . | |
bool | highlightSections |
whether the sections containing selected items are highlighted | |
bool | stretchLastSection |
whether the last visible section in the header takes up all the available space | |
bool | cascadingSectionResizes |
whether interactive resizing will be cascaded to the following sections once the section being resized by the user has reached its minimum size | |
int | defaultSectionSize |
the default size of the header sections before resizing. | |
int | minimumSectionSize |
the minimum size of the header sections. | |
int | maximumSectionSize |
the maximum size of the header sections. | |
Qt::Alignment | defaultAlignment |
the default alignment of the text in each header section | |
bool | sortIndicatorClearable |
Whether the sort indicator can be cleared by clicking on a section multiple times. | |
Properties inherited from QAbstractItemView | |
bool | autoScroll |
whether autoscrolling in drag move events is enabled | |
int | autoScrollMargin |
the size of the area when auto scrolling is triggered | |
EditTriggers | editTriggers |
which actions will initiate item editing | |
bool | tabKeyNavigation |
whether item navigation with tab and backtab is enabled. | |
bool | alternatingRowColors |
whether to draw the background using alternating colors | |
SelectionMode | selectionMode |
which selection mode the view operates in | |
SelectionBehavior | selectionBehavior |
which selection behavior the view uses | |
QSize | iconSize |
the size of items' icons | |
Qt::TextElideMode | textElideMode |
the position of the "..." in elided text. | |
ScrollMode | verticalScrollMode |
how the view scrolls its contents in the vertical direction | |
ScrollMode | horizontalScrollMode |
how the view scrolls its contents in the horizontal direction | |
Private Member Functions | |
void | initStyleOption (QStyleOptionFrame *option) const override |
Friends | |
class | QTableView |
class | QTreeView |
Additional Inherited Members | |
Protected Types inherited from QAbstractItemView | |
enum | CursorAction { MoveUp , MoveDown , MoveLeft , MoveRight , MoveHome , MoveEnd , MovePageUp , MovePageDown , MoveNext , MovePrevious } |
This enum describes the different ways to navigate between items,. More... | |
enum | State { NoState , DraggingState , DragSelectingState , EditingState , ExpandingState , CollapsingState , AnimatingState } |
Describes the different states the view can be in. More... | |
The QHeaderView class provides a header row or header column for item views.
\inmodule QtWidgets
A QHeaderView displays the headers used in item views such as the QTableView and QTreeView classes. It takes the place of Qt3's QHeader
class previously used for the same purpose, but uses the Qt's model/view architecture for consistency with the item view classes.
The QHeaderView class is one of the \l{Model/View Classes} and is part of Qt's \l{Model/View Programming}{model/view framework}.
The header gets the data for each section from the model using the QAbstractItemModel::headerData() function. You can set the data by using QAbstractItemModel::setHeaderData().
Each header has an orientation() and a number of sections, given by the count() function. A section refers to a part of the header - either a row or a column, depending on the orientation.
Sections can be moved and resized using moveSection() and resizeSection(); they can also 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 visualIndex() 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.
For a horizontal header the section is equivalent to a column in the model, and for a vertical header the section is equivalent to a row in the model.
Definition at line 17 of file qheaderview.h.
The resize mode specifies the behavior of the header sections.
It can be set on the entire header view or on individual sections using setSectionResizeMode().
\value Interactive The user can resize the section. The section can also be resized programmatically using resizeSection(). The section size defaults to \l defaultSectionSize. (See also \l cascadingSectionResizes.)
\value Fixed The user cannot resize the section. The section can only be resized programmatically using resizeSection(). The section size defaults to \l defaultSectionSize.
\value Stretch QHeaderView will automatically resize the section to fill the available space. The size cannot be changed by the user or programmatically.
\value ResizeToContents QHeaderView will automatically resize the section to its optimal size based on the contents of the entire column or row. The size cannot be changed by the user or programmatically. (This value was introduced in 4.2)
The following values are obsolete: \value Custom Use Fixed instead.
Enumerator | |
---|---|
Interactive | |
Stretch | |
Fixed | |
ResizeToContents | |
Custom |
Definition at line 38 of file qheaderview.h.
|
explicit |
Creates a new generic header with the given orientation and parent.
Definition at line 272 of file qheaderview.cpp.
References d, initialize(), and orientation().
|
virtual |
|
protected |
Definition at line 283 of file qheaderview.cpp.
References d, initialize(), and orientation().
bool QHeaderView::cascadingSectionResizes | ( | ) | const |
Definition at line 1484 of file qheaderview.cpp.
References d.
int QHeaderView::count | ( | ) | const |
Returns the number of sections in the header.
Definition at line 1006 of file qheaderview.cpp.
References d.
Referenced by QTreeViewPrivate::adjustViewOptionsForIndex(), QTreeViewPrivate::calcLogicalIndices(), QTreeView::drawRow(), headerDataChanged(), QTreeView::moveCursor(), paintEvent(), QTableView::paintEvent(), resizeSection(), sectionsInserted(), sectionSize(), sectionSizeHint(), sectionViewportPosition(), setSectionHidden(), setSectionResizeMode(), setSortIndicatorShown(), sizeHint(), QTreeViewPrivate::startAndEndColumns(), QTreeViewPrivate::updateScrollBars(), and visualRegionForSelection().
|
overrideprotectedvirtual |
\reimp
Reimplemented from QAbstractItemView.
Definition at line 2318 of file qheaderview.cpp.
References QModelIndex::column(), d, Qt::Horizontal, QModelIndex::isValid(), QModelIndex::parent(), QModelIndex::row(), sectionSize(), sectionViewportPosition(), and Qt::Vertical.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QAbstractItemView.
Definition at line 3082 of file qheaderview.cpp.
References QModelIndex::column(), d, Qt::DecorationRole, Qt::DisplayRole, Qt::FontRole, Qt::Horizontal, i, orientation(), ResizeToContents, QModelIndex::row(), sectionResizeMode(), Qt::SizeHintRole, and Qt::UserRole.
Qt::Alignment QHeaderView::defaultAlignment | ( | ) | const |
Definition at line 1643 of file qheaderview.cpp.
References d.
int QHeaderView::defaultSectionSize | ( | ) | const |
Definition at line 1510 of file qheaderview.cpp.
References d.
|
overridevirtual |
Reimplemented from QAbstractItemView.
Definition at line 1662 of file qheaderview.cpp.
References QAbstractItemView::doItemsLayout(), and initializeSections().
|
overrideprotected |
\reimp
Definition at line 2344 of file qheaderview.cpp.
References d, QAbstractItemView::event(), QEvent::HoverEnter, QEvent::HoverLeave, QEvent::HoverMove, QEvent::Leave, logicalIndexAt(), resizeSections(), QEvent::StyleChange, QEvent::Timer, QEvent::type(), and updateSection().
|
signal |
This signal is emitted when the header's geometries have changed.
Referenced by QTreeView::setHeader(), QTableView::setHorizontalHeader(), QTableView::setVerticalHeader(), and viewportEvent().
|
slot |
Updates the changed header sections with the given orientation, from logicalFirst to logicalLast inclusive.
Definition at line 1773 of file qheaderview.cpp.
References count(), d, Qt::Horizontal, orientation(), qMax(), qMin(), and visualIndex().
Referenced by setModel().
int QHeaderView::hiddenSectionCount | ( | ) | const |
Returns the number of sections in the header that has been hidden.
Definition at line 949 of file qheaderview.cpp.
References d.
|
inline |
Hides the section specified by logicalIndex.
Definition at line 224 of file qheaderview.h.
References setSectionHidden().
bool QHeaderView::highlightSections | ( | ) | const |
Definition at line 1159 of file qheaderview.cpp.
References d.
|
overrideprotectedvirtual |
Returns the horizontal offset of the header.
This is 0 for vertical headers.
Implements QAbstractItemView.
Definition at line 3031 of file qheaderview.cpp.
References d, and Qt::Horizontal.
|
overrideprotectedvirtual |
\reimp
Empty implementation because the header doesn't show QModelIndex items.
Implements QAbstractItemView.
Definition at line 3156 of file qheaderview.cpp.
|
protected |
Definition at line 305 of file qheaderview.cpp.
References QPalette::Button, d, Qt::ElideNone, Qt::NoFocus, Qt::ScrollBarAlwaysOff, and setFrameStyle().
Referenced by QHeaderView(), and QHeaderView().
|
protected |
Definition at line 2221 of file qheaderview.cpp.
References d, emit, initializeSections(), qBound(), sectionCountChanged(), and stretchLastSection.
Referenced by doItemsLayout(), initializeSections(), reset(), setModel(), and setSectionResizeMode().
|
protected |
Definition at line 2246 of file qheaderview.cpp.
References QSet< T >::begin(), d, emit, QSet< T >::end(), QSet< T >::erase(), i, it, j, Q_ASSERT, ResizeToContents, sectionCountChanged(), and Stretch.
|
overrideprivate |
Definition at line 3417 of file qheaderview.cpp.
References QFrame::initStyleOption().
|
protectedvirtual |
Initialize option with the values from this QHeaderView.
This method is useful for subclasses when they need a QStyleOptionHeader, but do not want to fill in all the information themselves.
Definition at line 3404 of file qheaderview.cpp.
References d, Qt::Horizontal, QStyle::State_Enabled, QStyle::State_Horizontal, QStyle::State_None, and QStyle::State_Raised.
Referenced by paintSection(), and sectionSizeFromContents().
|
protectedvirtual |
Initializes the style option from the specified logicalIndex. This function is called by the default implementation of paintSection after initStyleOption has been called.
Definition at line 2849 of file qheaderview.cpp.
References Qt::AlignVCenter, Qt::AscendingOrder, Qt::BackgroundRole, QStyleOptionHeader::Beginning, QPalette::Button, QPalette::ButtonText, QVariant::canConvert(), d, Qt::DecorationRole, Qt::DisplayRole, QStyleOptionHeader::End, QStyleOption::fontMetrics, Qt::FontRole, Qt::ForegroundRole, QStyleOptionButton::icon, QIcon::isNull(), isSortIndicatorShown(), QVariant::isValid(), logicalIndex(), QStyleOptionHeader::Middle, QStyleOptionHeader::NextAndPreviousAreSelected, QStyleOptionHeader::NextIsSelected, QStyleOptionHeader::NotAdjacent, QStyleOptionHeader::OnlyOneSection, opt, QStyleOption::palette, QStyleOptionHeader::PreviousIsSelected, Q_ASSERT, QPalette::setBrush(), QStyleOptionHeader::SortDown, sortIndicatorOrder(), sortIndicatorSection(), QStyleOptionHeader::SortUp, QAbstractItemView::state(), QStyleOption::state, QStyle::State_Active, QStyle::State_MouseOver, QStyle::State_None, QStyle::State_On, QStyle::State_Sunken, QStyleOptionButton::text, Qt::TextAlignmentRole, var, variant, visualIndex(), QPalette::Window, and window().
Referenced by paintSection().
bool QHeaderView::isFirstSectionMovable | ( | ) | const |
Definition at line 1120 of file qheaderview.cpp.
References d.
|
overrideprotectedvirtual |
\reimp
Empty implementation because the header doesn't show QModelIndex items.
Implements QAbstractItemView.
Definition at line 3168 of file qheaderview.cpp.
bool QHeaderView::isSectionHidden | ( | int | logicalIndex | ) | const |
Returns true
if the section specified by logicalIndex is explicitly hidden from the user; otherwise returns false
.
Definition at line 931 of file qheaderview.cpp.
References d, logicalIndex(), Q_ASSERT, and visualIndex().
Referenced by QTreeViewPrivate::calcLogicalIndices(), QTreeViewPrivate::columnRanges(), QTableViewPrivate::isColumnHidden(), QTableViewPrivate::isRowHidden(), QTableView::paintEvent(), resizeSection(), sectionSize(), sectionSizeHint(), sizeHint(), and QTableViewPrivate::trimHiddenSelections().
bool QHeaderView::isSortIndicatorClearable | ( | ) | const |
Definition at line 1427 of file qheaderview.cpp.
References d.
bool QHeaderView::isSortIndicatorShown | ( | ) | const |
Definition at line 1323 of file qheaderview.cpp.
References d.
Referenced by initStyleOptionForIndex(), and sectionSizeFromContents().
int QHeaderView::length | ( | ) | const |
Returns the length along the orientation of the header.
Definition at line 460 of file qheaderview.cpp.
References d.
Referenced by QTreeView::drawRow(), QTableView::paintEvent(), setOffsetToLastSection(), QTreeViewPrivate::updateScrollBars(), and QTreeViewPrivate::visualRect().
int QHeaderView::logicalIndex | ( | int | visualIndex | ) | const |
Returns the logicalIndex for the section at the given visualIndex position, or -1 if visualIndex < 0 or visualIndex >= QHeaderView::count().
Note that the visualIndex is not affected by hidden sections.
Definition at line 1050 of file qheaderview.cpp.
References d, and visualIndex().
Referenced by QTreeViewPrivate::calcLogicalIndices(), QTreeViewPrivate::columnRanges(), QTreeView::drawRow(), initStyleOptionForIndex(), isSectionHidden(), logicalIndexAt(), QTreeViewPrivate::logicalIndexForTree(), mouseMoveEvent(), moveSection(), paintEvent(), QTableView::paintEvent(), paintSection(), sectionPosition(), sectionResizeMode(), sectionSize(), sectionSizeFromContents(), sectionSizeHint(), sectionViewportPosition(), setMaximumSectionSize(), setMinimumSectionSize(), setSectionHidden(), setSectionResizeMode(), setSortIndicator(), QTreeViewPrivate::updateScrollBars(), updateSection(), visualIndex(), and visualRegionForSelection().
|
inline |
Returns the logical index of the section at the position given in pos.
If the header is horizontal the x-coordinate will be used, otherwise the y-coordinate will be used to find the logical index.
Definition at line 222 of file qheaderview.h.
References logicalIndexAt().
int QHeaderView::logicalIndexAt | ( | int | position | ) | const |
Returns the section that covers the given position in the viewport.
Definition at line 585 of file qheaderview.cpp.
References logicalIndex(), position(), and visualIndexAt().
Referenced by QTreeViewPrivate::columnAt(), event(), QTreeViewPrivate::itemDecorationAt(), logicalIndexAt(), logicalIndexAt(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), QTableViewPrivate::selectColumn(), QTableViewPrivate::selectRow(), viewportEvent(), and QTreeWidget::visualItemRect().
|
inline |
Returns the logical index of the section at the given coordinate.
If the header is horizontal x will be used, otherwise y will be used to find the logical index.
Definition at line 220 of file qheaderview.h.
References Qt::Horizontal, logicalIndexAt(), and orientation().
int QHeaderView::maximumSectionSize | ( | ) | const |
Definition at line 1598 of file qheaderview.cpp.
References d, and maxSizeSection.
int QHeaderView::minimumSectionSize | ( | ) | const |
Definition at line 1546 of file qheaderview.cpp.
References d, fontMetrics, Qt::Horizontal, and QStyle::PM_HeaderMargin.
|
overrideprotected |
\reimp
Definition at line 2734 of file qheaderview.cpp.
References Qt::ArrowCursor, cursor, d, emit, Qt::Horizontal, Interactive, logicalIndexAt(), pos, QSinglePointEvent::position(), sectionDoubleClicked(), sectionHandleDoubleClicked(), sectionResizeMode(), setCursor(), Qt::SplitHCursor, Qt::SplitVCursor, and QPointF::toPoint().
|
overrideprotected |
\reimp
Definition at line 2543 of file qheaderview.cpp.
References QSinglePointEvent::buttons(), d, emit, Qt::Horizontal, Interactive, QString::isEmpty(), logicalIndex(), logicalIndexAt(), maximumSectionSize, minimumSectionSize, QHeaderViewPrivate::MoveSection, Qt::NoButton, QHeaderViewPrivate::NoState, pos, QMouseEvent::pos(), QSinglePointEvent::position(), Q_ASSERT, qAbs(), qBound(), qMax(), QT_CONFIG, resizeSection(), QHeaderViewPrivate::ResizeSection, sectionEntered(), sectionResizeMode(), QHeaderViewPrivate::SelectSections, QCoreApplication::sendEvent(), setCursor(), Qt::SplitHCursor, Qt::SplitVCursor, QApplication::startDragDistance, QAbstractItemView::state(), Qt::StatusTipRole, QPointF::toPoint(), unsetCursor(), updateSection(), visualIndex(), visualIndexAt(), and Qt::WA_SetCursor.
|
overrideprotected |
\reimp
Definition at line 2498 of file qheaderview.cpp.
References QSinglePointEvent::button(), d, emit, Qt::Horizontal, Interactive, Qt::LeftButton, logicalIndexAt(), QHeaderViewPrivate::MoveSection, QHeaderViewPrivate::NoState, pos, QSinglePointEvent::position(), QHeaderViewPrivate::ResizeSection, sectionPressed(), sectionResizeMode(), sectionSize(), QHeaderViewPrivate::SelectSections, QPointF::toPoint(), and updateSection().
|
overrideprotected |
\reimp
Definition at line 2661 of file qheaderview.cpp.
References d, emit, Qt::Horizontal, logicalIndexAt(), moveSection(), QHeaderViewPrivate::MoveSection, QHeaderViewPrivate::NoState, pos, QSinglePointEvent::position(), Q_ASSERT, Q_FALLTHROUGH, QT_CONFIG, QHeaderViewPrivate::ResizeSection, sectionClicked(), sectionSize(), sectionViewportPosition(), QHeaderViewPrivate::SelectSections, QRect::setRect(), QPointF::toPoint(), updateSection(), Qt::Vertical, and visualIndex().
|
overrideprotectedvirtual |
\reimp
Empty implementation because the header doesn't show QModelIndex items.
Implements QAbstractItemView.
Definition at line 3180 of file qheaderview.cpp.
void QHeaderView::moveSection | ( | int | from, |
int | to ) |
Moves the section at visual index from to occupy visual index to.
Definition at line 699 of file qheaderview.cpp.
References d, emit, logicalIndex(), Q_ASSERT, qMoveRange(), sectionMoved(), stretchLastSection, updateSection(), and visualIndex().
Referenced by mouseReleaseEvent().
int QHeaderView::offset | ( | ) | const |
Returns the offset of the header: this is the header's left-most (or top-most for vertical headers) visible pixel.
Definition at line 387 of file qheaderview.cpp.
References d.
Referenced by QTreeView::drawRow(), and QTableView::paintEvent().
Qt::Orientation QHeaderView::orientation | ( | ) | const |
Returns the orientation of the header.
Definition at line 374 of file qheaderview.cpp.
References d.
Referenced by QHeaderView(), QHeaderView(), dataChanged(), headerDataChanged(), and logicalIndexAt().
|
overrideprotected |
\reimp
Definition at line 2392 of file qheaderview.cpp.
References QVariant::canConvert(), QStyle::CE_HeaderEmptyArea, count(), d, QPainter::fillRect(), Qt::FontRole, Qt::Horizontal, i, QStyleOption::initFrom(), QVariant::isValid(), logicalIndex(), opt, painter, paintSection(), qMax(), qMin(), QPaintEvent::rect(), QStyleOption::rect, QPainter::restore(), QPainter::save(), sectionSize(), sectionViewportPosition(), QPainter::setFont(), QStyleOption::state, QStyle::State_Horizontal, QRect::translate(), variant, visualIndexAt(), and QRect::width().
|
protectedvirtual |
Paints the section specified by the given logicalIndex, using the given painter and rect.
Normally, you do not have to call this function.
Definition at line 2951 of file qheaderview.cpp.
References QPalette::brush(), QPainter::brushOrigin(), QPalette::Button, QStyle::CE_Header, initStyleOption(), initStyleOptionForIndex(), logicalIndex(), opt, painter, QStyleOption::palette, rect, QStyleOption::rect, QPainter::setBrushOrigin(), QRect::topLeft(), and QPalette::Window.
Referenced by paintEvent().
|
overridevirtual |
\reimp
Reimplemented from QAbstractItemView.
Definition at line 1758 of file qheaderview.cpp.
References d, initializeSections(), and QAbstractItemView::reset().
void QHeaderView::resetDefaultSectionSize | ( | ) |
Definition at line 1524 of file qheaderview.cpp.
References d.
int QHeaderView::resizeContentsPrecision | ( | ) | const |
Definition at line 1275 of file qheaderview.cpp.
References d.
void QHeaderView::resizeSection | ( | int | logicalIndex, |
int | size ) |
Resizes the section specified by logicalIndex to size measured in pixels.
The size parameter must be a value larger or equal to zero. A size equal to zero is however not recommended. In that situation hideSection should be used instead.
Definition at line 822 of file qheaderview.cpp.
References count(), d, emit, Qt::Horizontal, isSectionHidden(), maximumSectionSize, maxSizeSection, minimumSectionSize, pos, qBound(), QHeaderViewPrivate::ResizeSection, sectionResized(), sectionViewportPosition(), QRect::setRect(), stretchLastSection, and visualIndex().
Referenced by mouseMoveEvent(), setMaximumSectionSize(), setMinimumSectionSize(), and setSectionHidden().
|
protectedslot |
Resizes the sections according to their size hints.
Normally, you do not have to call this function.
Definition at line 1827 of file qheaderview.cpp.
References d, and Interactive.
Referenced by event(), setSortIndicator(), setSortIndicatorShown(), setStretchLastSection(), and viewportEvent().
void QHeaderView::resizeSections | ( | QHeaderView::ResizeMode | mode | ) |
Resizes the sections according to the given mode, ignoring the current resize mode.
Definition at line 902 of file qheaderview.cpp.
References d.
bool QHeaderView::restoreState | ( | const QByteArray & | state | ) |
true
if the state was restored; otherwise returns false.Definition at line 1724 of file qheaderview.cpp.
References d, emit, QIODeviceBase::ReadOnly, sortIndicatorChanged(), QAbstractItemView::state(), and QHeaderViewPrivate::VersionMarker.
|
overrideprotectedvirtual |
\reimp
Empty implementation because the header doesn't show QModelIndex items.
Reimplemented from QAbstractItemView.
Definition at line 3120 of file qheaderview.cpp.
QByteArray QHeaderView::saveState | ( | ) | const |
Saves the current state of this header view.
To restore the saved state, pass the return value to restoreState().
Definition at line 1704 of file qheaderview.cpp.
References d, QHeaderViewPrivate::VersionMarker, and QIODeviceBase::WriteOnly.
|
overrideprotected |
|
overrideprotectedvirtual |
\reimp
Empty implementation because the header doesn't show QModelIndex items.
Implements QAbstractItemView.
Definition at line 3144 of file qheaderview.cpp.
|
signal |
This signal is emitted when a section is clicked.
The section's logical index is specified by logicalIndex.
Note that the sectionPressed signal will also be emitted.
Referenced by mouseReleaseEvent().
|
signal |
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.
Referenced by initializeSections(), initializeSections(), sectionsInserted(), QTreeView::setHeader(), QTableView::setHorizontalHeader(), and QTableView::setVerticalHeader().
|
signal |
This signal is emitted when a section is double-clicked.
The section's logical index is specified by logicalIndex.
Referenced by mouseDoubleClickEvent().
|
signal |
This signal is emitted when the cursor moves over the section and the left mouse button is pressed. The section's logical index is specified by logicalIndex.
Referenced by mouseMoveEvent(), QTableView::setSortingEnabled(), and QTableView::setVerticalHeader().
|
signal |
This signal is emitted when a section is double-clicked.
The section's logical index is specified by logicalIndex.
Referenced by mouseDoubleClickEvent(), QTreeView::setHeader(), QTableView::setHorizontalHeader(), and QTableView::setVerticalHeader().
|
signal |
This signal is emitted when a section is moved.
The section's logical index is specified by logicalIndex, the old index by oldVisualIndex, and the new index position by newVisualIndex.
Referenced by moveSection(), QTreeView::setHeader(), QTableView::setHorizontalHeader(), QTableView::setVerticalHeader(), and swapSections().
int QHeaderView::sectionPosition | ( | int | logicalIndex | ) | const |
Returns the section position of the given logicalIndex, or -1 if the section is hidden.
The position is measured in pixels from the first visible item's top-left corner to the top-left corner of the item with logicalIndex. The measurement is along the x-axis for horizontal headers and along the y-axis for vertical headers.
Definition at line 625 of file qheaderview.cpp.
References d, logicalIndex(), and visualIndex().
Referenced by QTreeView::drawRow(), and sectionViewportPosition().
|
signal |
This signal is emitted when a section is pressed.
The section's logical index is specified by logicalIndex.
Referenced by mousePressEvent(), QTableView::setSortingEnabled(), and QTableView::setVerticalHeader().
|
signal |
This signal is emitted when a section is resized.
The section's logical number is specified by logicalIndex, the old size by oldSize, and the new size by newSize.
Referenced by resizeSection(), QTreeView::setHeader(), QTableView::setHorizontalHeader(), and QTableView::setVerticalHeader().
QHeaderView::ResizeMode QHeaderView::sectionResizeMode | ( | int | logicalIndex | ) | const |
Returns the resize mode that applies to the section specified by the given logicalIndex.
Definition at line 1230 of file qheaderview.cpp.
References d, Fixed, logicalIndex(), and visualIndex().
Referenced by dataChanged(), mouseDoubleClickEvent(), mouseMoveEvent(), mousePressEvent(), and setSortIndicator().
|
protectedslot |
This slot is called when sections are removed from the parent.
logicalFirst and logicalLast signify where the sections were removed.
If only one section is removed, logicalFirst and logicalLast will be the same.
Definition at line 1948 of file qheaderview.cpp.
References Q_UNUSED.
Referenced by setModel().
bool QHeaderView::sectionsClickable | ( | ) | const |
bool QHeaderView::sectionsHidden | ( | ) | const |
Returns true
if sections in the header has been hidden; otherwise returns false;
Definition at line 1688 of file qheaderview.cpp.
References d.
Referenced by QTableView::paintEvent().
|
protectedslot |
This slot is called when sections are inserted into the parent.
logicalFirst and logicalLast indices signify where the new sections were inserted.
If only one section is inserted, logicalFirst and logicalLast will be the same.
Definition at line 1843 of file qheaderview.cpp.
References QSet< T >::cbegin(), count(), d, emit, i, it, j, Q_ASSERT, QHeaderViewPrivate::ResizeSection, ResizeToContents, sectionCountChanged(), Stretch, stretchLastSection, and QSet< T >::swap().
Referenced by setModel().
int QHeaderView::sectionSize | ( | int | logicalIndex | ) | const |
Returns the width (or height for vertical headers) of the given logicalIndex.
Definition at line 600 of file qheaderview.cpp.
References count(), d, isSectionHidden(), logicalIndex(), and visualIndex().
Referenced by currentChanged(), QTreeView::drawRow(), QTableViewPrivate::intersectedRect(), QTreeViewPrivate::itemDecorationRect(), mousePressEvent(), mouseReleaseEvent(), paintEvent(), QTableView::paintEvent(), sectionViewportPosition(), QTreeViewPrivate::updateScrollBars(), updateSection(), and visualRegionForSelection().
|
protectedvirtual |
Returns the size of the contents of the section specified by the given logicalIndex.
Definition at line 2988 of file qheaderview.cpp.
References QVariant::canConvert(), QStyle::CT_HeaderSection, d, Qt::DecorationRole, Qt::DisplayRole, font, QStyleOption::fontMetrics, Qt::FontRole, QStyleOptionButton::icon, initStyleOption(), QIcon::isNull(), isSortIndicatorShown(), QVariant::isValid(), logicalIndex(), opt, Q_ASSERT, QFont::setBold(), Qt::SizeHintRole, QStyleOptionHeader::SortDown, QStyleOptionButton::text, var, and variant.
Referenced by sectionSizeHint(), and sizeHint().
int QHeaderView::sectionSizeHint | ( | int | logicalIndex | ) | const |
Returns a suitable size hint for the section specified by logicalIndex.
Definition at line 527 of file qheaderview.cpp.
References count(), d, hint(), Qt::Horizontal, isSectionHidden(), logicalIndex(), maximumSectionSize, minimumSectionSize, qBound(), sectionSizeFromContents(), and Qt::SizeHintRole.
Referenced by QTreeView::resizeColumnToContents().
bool QHeaderView::sectionsMovable | ( | ) | const |
bool QHeaderView::sectionsMoved | ( | ) | const |
Returns true
if sections in the header has been moved; otherwise returns false;.
Definition at line 1674 of file qheaderview.cpp.
References d.
Referenced by QTableViewPrivate::drawAndClipSpans(), QTreeView::drawRow(), QTableViewPrivate::intersectedRect(), QTableViewPrivate::selectColumn(), QTableViewPrivate::selectRow(), QTableView::setSelection(), and QTableView::visualRegionForSelection().
int QHeaderView::sectionViewportPosition | ( | int | logicalIndex | ) | const |
Returns the section viewport position of the given logicalIndex.
If the section is hidden, the return value is undefined.
Definition at line 645 of file qheaderview.cpp.
References count(), d, logicalIndex(), position(), sectionPosition(), and sectionSize().
Referenced by currentChanged(), QTableViewPrivate::intersectedRect(), QTreeViewPrivate::itemDecorationRect(), mouseReleaseEvent(), paintEvent(), resizeSection(), updateSection(), visualRegionForSelection(), and QTableViewPrivate::visualSpanRect().
void QHeaderView::setCascadingSectionResizes | ( | bool | enable | ) |
Definition at line 1490 of file qheaderview.cpp.
References d.
void QHeaderView::setDefaultAlignment | ( | Qt::Alignment | alignment | ) |
Definition at line 1649 of file qheaderview.cpp.
Referenced by QTreeViewPrivate::initialize().
void QHeaderView::setDefaultSectionSize | ( | int | size | ) |
Definition at line 1516 of file qheaderview.cpp.
References d, and maxSizeSection.
void QHeaderView::setFirstSectionMovable | ( | bool | movable | ) |
Definition at line 1114 of file qheaderview.cpp.
References d.
Referenced by QTreeView::setHeader().
void QHeaderView::setHighlightSections | ( | bool | highlight | ) |
Definition at line 1153 of file qheaderview.cpp.
References d.
Referenced by QTableViewPrivate::init().
void QHeaderView::setMaximumSectionSize | ( | int | size | ) |
Definition at line 1606 of file qheaderview.cpp.
References d, logicalIndex(), maxSizeSection, minimumSectionSize, and resizeSection().
Referenced by setMinimumSectionSize().
void QHeaderView::setMinimumSectionSize | ( | int | size | ) |
Definition at line 1558 of file qheaderview.cpp.
References d, logicalIndex(), maximumSectionSize, maxSizeSection, resizeSection(), and setMaximumSectionSize().
|
overridevirtual |
\reimp
Reimplemented from QAbstractItemView.
Definition at line 321 of file qheaderview.cpp.
References QAbstractItemModel::columnsAboutToBeMoved(), QAbstractItemModel::columnsAboutToBeRemoved(), QAbstractItemModel::columnsInserted(), QAbstractItemModel::columnsMoved(), QAbstractItemModel::columnsRemoved(), QObject::connect(), QObjectPrivate::connect(), d, QAbstractItemModel::headerDataChanged(), headerDataChanged(), Qt::Horizontal, initializeSections(), QAbstractItemModel::layoutAboutToBeChanged(), QAbstractItemModel::layoutChanged(), QAbstractItemView::model(), QHeaderViewPrivate::NoClear, QHeaderViewPrivate::NoState, QAbstractItemModel::rowsAboutToBeMoved(), QAbstractItemModel::rowsAboutToBeRemoved(), QAbstractItemModel::rowsInserted(), QAbstractItemModel::rowsMoved(), QAbstractItemModel::rowsRemoved(), QHeaderViewPrivate::sectionsAboutToBeChanged(), QHeaderViewPrivate::sectionsAboutToBeMoved(), sectionsAboutToBeRemoved(), QHeaderViewPrivate::sectionsChanged(), sectionsInserted(), QHeaderViewPrivate::sectionsMoved(), QHeaderViewPrivate::sectionsRemoved(), QAbstractItemView::setModel(), and QAbstractItemModelPrivate::staticEmptyModel().
|
slot |
Sets the header's offset to offset.
Definition at line 401 of file qheaderview.cpp.
References d, Qt::Horizontal, QCursor::pos(), QHeaderViewPrivate::ResizeSection, QCursor::setPos(), QPoint::x(), and QPoint::y().
Referenced by setOffsetToLastSection(), and setOffsetToSectionPosition().
|
slot |
Definition at line 446 of file qheaderview.cpp.
References d, Qt::Horizontal, length(), position(), setOffset(), and viewport().
|
slot |
Definition at line 431 of file qheaderview.cpp.
References d, position(), and setOffset().
void QHeaderView::setResizeContentsPrecision | ( | int | precision | ) |
The number precision specifies how many sections that should be consider when calculating the preferred size.
The default value is 1000 meaning that a horizontal column with auto-resize will look at maximum 1000 rows on calculating when doing an auto resize.
Special value 0 means that it will look at only the visible area. Special value -1 will imply looking at all elements.
This value is used in QTableView::sizeHintForColumn(), QTableView::sizeHintForRow() and QTreeView::sizeHintForColumn(). Reimplementing these functions can make this function not having an effect.
Definition at line 1261 of file qheaderview.cpp.
References d.
void QHeaderView::setSectionHidden | ( | int | logicalIndex, |
bool | hide ) |
If hide is true the section specified by logicalIndex is hidden; otherwise the section is shown.
Definition at line 962 of file qheaderview.cpp.
References count(), d, hide(), logicalIndex(), Q_ASSERT, resizeSection(), stretchLastSection, and visualIndex().
Referenced by hideSection(), and showSection().
void QHeaderView::setSectionResizeMode | ( | int | logicalIndex, |
ResizeMode | mode ) |
Sets the constraints on how the section specified by logicalIndex in the header can be resized to those described by the given mode. The logical index should exist at the time this function is called.
Definition at line 1199 of file qheaderview.cpp.
References d, logicalIndex(), QHeaderViewPrivate::NoState, Q_ASSERT, ResizeToContents, Stretch, and visualIndex().
void QHeaderView::setSectionResizeMode | ( | ResizeMode | mode | ) |
Sets the constraints on how the header can be resized to those described by the given mode.
Definition at line 1174 of file qheaderview.cpp.
References count(), d, initializeSections(), ResizeToContents, and Stretch.
void QHeaderView::setSectionsClickable | ( | bool | clickable | ) |
Set \l sectionsClickable to clickable.
Definition at line 1138 of file qheaderview.cpp.
References d.
Referenced by QTreeWidget::QTreeWidget(), QTableViewPrivate::init(), and QTreeView::setSortingEnabled().
void QHeaderView::setSectionsMovable | ( | bool | movable | ) |
Sets \l sectionsMovable to movable.
Definition at line 1075 of file qheaderview.cpp.
References d.
Referenced by QTreeViewPrivate::initialize().
|
overrideprotectedvirtual |
\reimp
Selects the items in the given rect according to the specified flags.
The base class implementation does nothing.
Implements QAbstractItemView.
Definition at line 3194 of file qheaderview.cpp.
void QHeaderView::setSortIndicator | ( | int | logicalIndex, |
Qt::SortOrder | order ) |
Sets the sort indicator for the section specified by the given logicalIndex in the direction specified by order, and removes the sort indicator from any other section that was showing it.
logicalIndex may be -1, in which case no sort indicator will be shown and the model will return to its natural, unsorted order. Note that not all models support this and may even crash in this case.
Definition at line 1341 of file qheaderview.cpp.
References d, emit, logicalIndex(), resizeSections(), ResizeToContents, sectionResizeMode(), sortIndicatorChanged(), and updateSection().
Referenced by QFileDialogTreeView::setFileDialogPrivate(), QTreeWidget::sortItems(), and QTableWidget::sortItems().
void QHeaderView::setSortIndicatorClearable | ( | bool | clearable | ) |
Definition at line 1418 of file qheaderview.cpp.
References d, emit, and sortIndicatorClearableChanged().
void QHeaderView::setSortIndicatorShown | ( | bool | show | ) |
Definition at line 1306 of file qheaderview.cpp.
References count(), d, resizeSections(), ResizeToContents, show(), and sortIndicatorSection().
Referenced by QTableView::setSortingEnabled(), and QTreeView::setSortingEnabled().
void QHeaderView::setStretchLastSection | ( | bool | stretch | ) |
Definition at line 1454 of file qheaderview.cpp.
References d, QHeaderViewPrivate::NoState, and resizeSections().
Referenced by QTreeViewPrivate::initialize(), and QFileDialogTreeView::setFileDialogPrivate().
|
override |
\reimp
Definition at line 508 of file qheaderview.cpp.
References isVisible().
Referenced by QtPrivate::QCalendarView::QCalendarView().
|
inline |
Shows the section specified by logicalIndex.
Definition at line 226 of file qheaderview.h.
References setSectionHidden().
|
override |
Returns a suitable size hint for this header.
Definition at line 475 of file qheaderview.cpp.
References count(), d, hint(), i, isSectionHidden(), j, qMax(), and sectionSizeFromContents().
Referenced by QFileDialogTreeView::sizeHint().
|
signal |
This signal is emitted when the section containing the sort indicator or the order indicated is changed. The section's logical index is specified by logicalIndex and the sort order is specified by order.
Referenced by restoreState(), setSortIndicator(), QTableView::setSortingEnabled(), and QTreeView::setSortingEnabled().
|
signal |
Qt::SortOrder QHeaderView::sortIndicatorOrder | ( | ) | const |
Returns the order for the sort indicator.
If no section has a sort indicator the return value of this function is undefined.
Definition at line 1392 of file qheaderview.cpp.
References d.
Referenced by QTableWidgetPrivate::dataChanged(), QTreeWidgetPrivate::dataChanged(), initStyleOptionForIndex(), QTableWidgetPrivate::sort(), and QTreeWidgetPrivate::sort().
int QHeaderView::sortIndicatorSection | ( | ) | const |
Returns the logical index of the section that has a sort indicator.
By default this is section 0.
Definition at line 1379 of file qheaderview.cpp.
References d.
Referenced by QTableWidgetPrivate::dataChanged(), QTreeWidgetPrivate::dataChanged(), initStyleOptionForIndex(), setSortIndicatorShown(), QTableWidgetPrivate::sort(), QTreeWidgetPrivate::sort(), and QTreeWidget::sortColumn().
bool QHeaderView::stretchLastSection | ( | ) | const |
Definition at line 1448 of file qheaderview.cpp.
References d.
int QHeaderView::stretchSectionCount | ( | ) | const |
Returns the number of sections that are set to resize mode stretch. In views, this can be used to see if the headerview needs to resize the sections when the view's geometry changes.
Definition at line 1291 of file qheaderview.cpp.
References d.
void QHeaderView::swapSections | ( | int | first, |
int | second ) |
Definition at line 761 of file qheaderview.cpp.
References d, emit, QHeaderViewPrivate::ResizeSection, sectionMoved(), stretchLastSection, and visualIndex().
|
overrideprotectedvirtual |
\reimp
Reimplemented from QAbstractItemView.
Definition at line 3059 of file qheaderview.cpp.
References d.
|
protectedslot |
Updates the section specified by the given logicalIndex.
Definition at line 1811 of file qheaderview.cpp.
References d, Qt::Horizontal, logicalIndex(), sectionSize(), and sectionViewportPosition().
Referenced by event(), mouseMoveEvent(), mousePressEvent(), mouseReleaseEvent(), moveSection(), and setSortIndicator().
|
overrideprotectedvirtual |
Returns the vertical offset of the header.
This is 0 for horizontal headers.
Implements QAbstractItemView.
Definition at line 3046 of file qheaderview.cpp.
References d, and Qt::Vertical.
|
overrideprotected |
\reimp
Definition at line 2760 of file qheaderview.cpp.
References QEvent::ContextMenu, d, emit, QEvent::FontChange, geometriesChanged(), QEvent::Hide, QString::isEmpty(), QVariant::isValid(), logicalIndexAt(), QHeaderViewPrivate::NoState, Q_FALLTHROUGH, QEvent::QueryWhatsThis, QEvent::Resize, resizeSections(), QCoreApplication::sendEvent(), QEvent::Show, QWhatsThis::showText(), QToolTip::showText(), QEvent::StatusTip, Qt::StatusTipRole, QEvent::StyleChange, QEvent::ToolTip, Qt::ToolTipRole, QVariant::toString(), QEvent::type(), variant, QAbstractItemView::viewportEvent(), QEvent::WhatsThis, Qt::WhatsThisRole, and QEvent::Wheel.
int QHeaderView::visualIndex | ( | int | logicalIndex | ) | const |
Returns the visual index position of the section specified by the given logicalIndex, or -1 otherwise.
Hidden sections still have valid visual indexes.
Definition at line 1024 of file qheaderview.cpp.
References d, logicalIndex(), and Q_ASSERT.
Referenced by QTreeViewPrivate::adjustViewOptionsForIndex(), QTreeViewPrivate::columnRanges(), QTableViewPrivate::drawAndClipSpans(), QTreeView::drawRow(), headerDataChanged(), initStyleOptionForIndex(), isSectionHidden(), logicalIndex(), mouseMoveEvent(), mouseReleaseEvent(), moveSection(), resizeSection(), sectionPosition(), sectionResizeMode(), sectionSize(), setSectionHidden(), setSectionResizeMode(), swapSections(), QTableWidget::visualColumn(), visualRegionForSelection(), and QTableWidget::visualRow().
int QHeaderView::visualIndexAt | ( | int | position | ) | const |
Returns the visual index of the section that covers the given position in the viewport.
Definition at line 551 of file qheaderview.cpp.
References d, and position().
Referenced by logicalIndexAt(), mouseMoveEvent(), paintEvent(), QTableView::paintEvent(), and QTreeViewPrivate::startAndEndColumns().
|
overrideprotectedvirtual |
\reimp
Empty implementation because the header doesn't show QModelIndex items.
Implements QAbstractItemView.
Definition at line 3132 of file qheaderview.cpp.
|
overrideprotectedvirtual |
Implements QAbstractItemView.
Definition at line 3203 of file qheaderview.cpp.
References count(), d, Qt::Horizontal, logicalIndex(), sectionSize(), sectionViewportPosition(), selection, and visualIndex().
|
friend |
Definition at line 210 of file qheaderview.h.
|
friend |
Definition at line 211 of file qheaderview.h.
|
readwrite |
whether interactive resizing will be cascaded to the following sections once the section being resized by the user has reached its minimum size
This property only affects sections that have \l Interactive as their resize mode.
The default value is false.
Definition at line 26 of file qheaderview.h.
|
readwrite |
the default alignment of the text in each header section
Definition at line 32 of file qheaderview.h.
|
readwrite |
the default size of the header sections before resizing.
This property only affects sections that have \l Interactive or \l Fixed as their resize mode.
By default, the value of this property is style dependent. Thus, when the style changes, this property updates from it. Calling setDefaultSectionSize() stops the updates, calling resetDefaultSectionSize() will restore default behavior.
Definition at line 28 of file qheaderview.h.
|
readwrite |
Whether the first column can be moved by the user.
This property controls whether the first column can be moved by the user. In a QTreeView, the first column holds the tree structure and is therefore non-movable by default, even after setSectionsMovable(true).
It can be made movable again, for instance in the case of flat lists without a tree structure, by calling this method. In such a scenario, it is recommended to call QTreeView::setRootIsDecorated(false) as well.
Setting it to true has no effect unless setSectionsMovable(true) is called as well.
Definition at line 20 of file qheaderview.h.
|
readwrite |
whether the sections containing selected items are highlighted
By default, this property is false
.
Definition at line 24 of file qheaderview.h.
|
readwrite |
the maximum size of the header sections.
The maximum section size is the largest section size allowed. The default value for this property is 1048575, which is also the largest possible size for a section. Setting maximum to -1 will reset the value to the largest section size.
With exception of stretch this property is honored by all \l{ResizeMode}{resize modes}
Definition at line 31 of file qheaderview.h.
Referenced by mouseMoveEvent(), resizeSection(), sectionSizeHint(), and setMinimumSectionSize().
|
readwrite |
the minimum size of the header sections.
The minimum section size is the smallest section size allowed. If the minimum section size is set to -1, QHeaderView will use the \l{fontMetrics()}{font metrics} size.
This property is honored by all \l{ResizeMode}{resize modes}.
Definition at line 30 of file qheaderview.h.
Referenced by mouseMoveEvent(), resizeSection(), sectionSizeHint(), and setMaximumSectionSize().
|
readwrite |
Holds true
if the header is clickable; otherwise 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.
Definition at line 23 of file qheaderview.h.
|
readwrite |
If sectionsMovable is true, the header sections may be moved by the user; otherwise they are fixed in place.
When used in combination with QTreeView, the first column is not movable (since it contains the tree structure), by default. You can make it movable with setFirstSectionMovable(true).
Definition at line 22 of file qheaderview.h.
|
readwrite |
whether the sort indicator is shown
By default, this property is false
.
Definition at line 21 of file qheaderview.h.
|
readwrite |
Whether the sort indicator can be cleared by clicking on a section multiple times.
This property controls whether the user is able to remove the sorting indicator on a given section by clicking on the section multiple times. Normally, clicking on a section will simply change the sorting order for that section. By setting this property to true, the sorting indicator will be cleared after alternating to ascending and descending; this will typically restore the original sorting of a model.
Setting this property to true has no effect unless sectionsClickable() is also true (which is the default for certain views, for instance QTableView, or is automatically set when making a view sortable, for instance by calling QTreeView::setSortingEnabled).
Definition at line 33 of file qheaderview.h.
|
readwrite |
whether the last visible section in the header takes up all the available space
The default value is false.
Definition at line 25 of file qheaderview.h.
Referenced by initializeSections(), moveSection(), resizeSection(), sectionsInserted(), setSectionHidden(), and swapSections().