- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Directories
- Examples

- Class List
- Class Hierarchy
- Class Members

Public Types | Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Properties

# QHeaderView Class Reference

Search for all occurrences

## Detailed Description

Definition at line 58 of file qheaderview.h.

`#include <qheaderview.h>`

Inheritance diagram for QHeaderView:
[legend]

List of all members.

## Public Types
enum | ResizeMode { Interactive, Stretch, Fixed, ResizeToContents, Custom = Fixed }
## Public Slots
void | setOffset (int offset)
void | setOffsetToSectionPosition (int visualIndex)
void | setOffsetToLastSection ()
void | headerDataChanged (Qt::Orientation orientation, int logicalFirst, int logicalLast)
## Signals
void | sectionMoved (int logicalIndex, int oldVisualIndex, int newVisualIndex)
void | sectionResized (int logicalIndex, int oldSize, int newSize)
void | sectionPressed (int logicalIndex)
void | sectionClicked (int logicalIndex)
void | sectionEntered (int logicalIndex)
void | sectionDoubleClicked (int logicalIndex)
void | sectionCountChanged (int oldCount, int newCount)
void | sectionHandleDoubleClicked (int logicalIndex)
void | sectionAutoResize (int logicalIndex, QHeaderView::ResizeMode mode)
void | geometriesChanged ()
void | sortIndicatorChanged (int logicalIndex, Qt::SortOrder order)
## Public Member Functions
| QHeaderView (Qt::Orientation orientation, QWidget *parent=0)
virtual | ~QHeaderView ()
void | setModel (QAbstractItemModel *model)
Qt::Orientation | orientation () const
int | offset () const
int | length () const
QSize | sizeHint () const
int | sectionSizeHint (int logicalIndex) const
int | visualIndexAt (int position) const
int | logicalIndexAt (int position) const
int | logicalIndexAt (int x, int y) const
int | logicalIndexAt (const QPoint &pos) const
int | sectionSize (int logicalIndex) const
int | sectionPosition (int logicalIndex) const
int | sectionViewportPosition (int logicalIndex) const
void | moveSection (int from, int to)
void | swapSections (int first, int second)
void | resizeSection (int logicalIndex, int size)
void | resizeSections (QHeaderView::ResizeMode mode)
bool | isSectionHidden (int logicalIndex) const
void | setSectionHidden (int logicalIndex, bool hide)
int | hiddenSectionCount () const
void | hideSection (int logicalIndex)
void | showSection (int logicalIndex)
int | count () const
int | visualIndex (int logicalIndex) const
int | logicalIndex (int visualIndex) const
void | setMovable (bool movable)
bool | isMovable () const
void | setClickable (bool clickable)
bool | isClickable () const
void | setHighlightSections (bool highlight)
bool | highlightSections () const
void | setResizeMode (ResizeMode mode)
void | setResizeMode (int logicalIndex, ResizeMode mode)
ResizeMode | resizeMode (int logicalIndex) const
int | stretchSectionCount () const
void | setSortIndicatorShown (bool show)
bool | isSortIndicatorShown () const
void | setSortIndicator (int logicalIndex, Qt::SortOrder order)
int | sortIndicatorSection () const
Qt::SortOrder | sortIndicatorOrder () const
bool | stretchLastSection () const
void | setStretchLastSection (bool stretch)
bool | cascadingSectionResizes () const
void | setCascadingSectionResizes (bool enable)
int | defaultSectionSize () const
void | setDefaultSectionSize (int size)
int | minimumSectionSize () const
void | setMinimumSectionSize (int size)
Qt::Alignment | defaultAlignment () const
void | setDefaultAlignment (Qt::Alignment alignment)
void | doItemsLayout ()
bool | sectionsMoved () const
bool | sectionsHidden () const
QByteArray | saveState () const
bool | restoreState (const QByteArray &state)
void | reset ()
## Protected Slots
void | updateSection (int logicalIndex)
void | resizeSections ()
void | sectionsInserted (const QModelIndex &parent, int logicalFirst, int logicalLast)
void | sectionsAboutToBeRemoved (const QModelIndex &parent, int logicalFirst, int logicalLast)
## Protected Member Functions
| QHeaderView (QHeaderViewPrivate &dd, Qt::Orientation orientation, QWidget *parent=0)
void | initialize ()
void | initializeSections ()
void | initializeSections (int start, int end)
void | currentChanged (const QModelIndex &current, const QModelIndex &old)
bool | event (QEvent *e)
void | paintEvent (QPaintEvent *e)
void | mousePressEvent (QMouseEvent *e)
void | mouseMoveEvent (QMouseEvent *e)
void | mouseReleaseEvent (QMouseEvent *e)
void | mouseDoubleClickEvent (QMouseEvent *e)
bool | viewportEvent (QEvent *e)
virtual void | paintSection (QPainter *painter, const QRect &rect, int logicalIndex) const
virtual QSize | sectionSizeFromContents (int logicalIndex) const
int | horizontalOffset () const
int | verticalOffset () const
void | updateGeometries ()
void | scrollContentsBy (int dx, int dy)
void | dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight)
void | rowsInserted (const QModelIndex &parent, int start, int end)
QRect | visualRect (const QModelIndex &index) const
void | scrollTo (const QModelIndex &index, ScrollHint hint)
QModelIndex | indexAt (const QPoint &p) const
bool | isIndexHidden (const QModelIndex &index) const
QModelIndex | moveCursor (CursorAction, Qt::KeyboardModifiers)
void | setSelection (const QRect &rect, QItemSelectionModel::SelectionFlags flags)
QRegion | visualRegionForSelection (const QItemSelection &selection) const
void | initStyleOption (QStyleOptionHeader *option) const
## Properties
bool | showSortIndicator
bool | highlightSections
bool | stretchLastSection
bool | cascadingSectionResizes
int | defaultSectionSize
int | minimumSectionSize
Qt::Alignment | defaultAlignment

## Member Enumeration Documentation

enum ResizeMode

Search for all occurrences

Enumerator:

  Interactive | Search for all occurrences
  Stretch | Search for all occurrences
  Fixed | Search for all occurrences
  ResizeToContents | Search for all occurrences
  Custom | Search for all occurrences

Definition at line 72 of file qheaderview.h.

        {
            Interactive,
            Stretch,
            Fixed,
            ResizeToContents,
            Custom = Fixed
        };

## Constructor & Destructor Documentation

QHeaderView | ( | Qt::Orientation | orientation,
|  | QWidget * | parent = `0`
| ) |  | `[explicit]`

virtual ~QHeaderView | ( |  | ) | `[virtual]`

QHeaderView | ( | QHeaderViewPrivate & | dd,
|  | Qt::Orientation | orientation,
|  | QWidget * | parent = `0`
| ) |  | `[protected]`

## Member Function Documentation

void setModel | ( | QAbstractItemModel * | model | ) | `[virtual]`

Search for all occurrences

Reimplemented from QAbstractItemView.

Qt::Orientation orientation | ( |  | ) | const

Search for all occurrences

int offset | ( |  | ) | const

Search for all occurrences

int length | ( |  | ) | const

Search for all occurrences

QSize sizeHint | ( |  | ) | const `[virtual]`

Search for all occurrences

Reimplemented from QAbstractScrollArea.

int sectionSizeHint | ( | int | logicalIndex | ) | const

Search for all occurrences

int visualIndexAt | ( | int | position | ) | const

Search for all occurrences

int logicalIndexAt | ( | int | position | ) | const

Search for all occurrences

int logicalIndexAt | ( | int | x,
|  | int | y
| ) |  | const `[inline]`

Search for all occurrences

Definition at line 235 of file qheaderview.h.

    { return orientation() == Qt::Horizontal ? logicalIndexAt(ax) : logicalIndexAt(ay); }

int logicalIndexAt | ( | const QPoint & | pos | ) | const `[inline]`

Search for all occurrences

Definition at line 237 of file qheaderview.h.

    { return logicalIndexAt(apos.x(), apos.y()); }

int sectionSize | ( | int | logicalIndex | ) | const

Search for all occurrences

int sectionPosition | ( | int | logicalIndex | ) | const

Search for all occurrences

int sectionViewportPosition | ( | int | logicalIndex | ) | const

Search for all occurrences

void moveSection | ( | int | from,
|  | int | to
| ) |  |

Search for all occurrences

void swapSections | ( | int | first,
|  | int | second
| ) |  |

Search for all occurrences

void resizeSection | ( | int | logicalIndex,
|  | int | size
| ) |  |

Search for all occurrences

void resizeSections | ( | QHeaderView::ResizeMode | mode | ) |

Search for all occurrences

bool isSectionHidden | ( | int | logicalIndex | ) | const

Search for all occurrences

void setSectionHidden | ( | int | logicalIndex,
|  | bool | hide
| ) |  |

Search for all occurrences

int hiddenSectionCount | ( |  | ) | const

Search for all occurrences

void hideSection | ( | int | logicalIndex | ) | `[inline]`

Search for all occurrences

Definition at line 239 of file qheaderview.h.

    { setSectionHidden(alogicalIndex, true); }

void showSection | ( | int | logicalIndex | ) | `[inline]`

Search for all occurrences

Definition at line 241 of file qheaderview.h.

    { setSectionHidden(alogicalIndex, false); }

int count | ( |  | ) | const

Search for all occurrences

int visualIndex | ( | int | logicalIndex | ) | const

Search for all occurrences

int logicalIndex | ( | int | visualIndex | ) | const

Search for all occurrences

void setMovable | ( | bool | movable | ) |

Search for all occurrences

bool isMovable | ( |  | ) | const

Search for all occurrences

void setClickable | ( | bool | clickable | ) |

Search for all occurrences

bool isClickable | ( |  | ) | const

Search for all occurrences

void setHighlightSections | ( | bool | highlight | ) |

Search for all occurrences

bool highlightSections | ( |  | ) | const

Search for all occurrences

void setResizeMode | ( | ResizeMode | mode | ) |

Search for all occurrences

void setResizeMode | ( | int | logicalIndex,
|  | ResizeMode | mode
| ) |  |

Search for all occurrences

ResizeMode resizeMode | ( | int | logicalIndex | ) | const

Search for all occurrences

int stretchSectionCount | ( |  | ) | const

Search for all occurrences

void setSortIndicatorShown | ( | bool | show | ) |

Search for all occurrences

bool isSortIndicatorShown | ( |  | ) | const

Search for all occurrences

void setSortIndicator | ( | int | logicalIndex,
|  | Qt::SortOrder | order
| ) |  |

Search for all occurrences

int sortIndicatorSection | ( |  | ) | const

Search for all occurrences

Qt::SortOrder sortIndicatorOrder | ( |  | ) | const

Search for all occurrences

bool stretchLastSection | ( |  | ) | const

Search for all occurrences

void setStretchLastSection | ( | bool | stretch | ) |

Search for all occurrences

bool cascadingSectionResizes | ( |  | ) | const

Search for all occurrences

void setCascadingSectionResizes | ( | bool | enable | ) |

Search for all occurrences

int defaultSectionSize | ( |  | ) | const

Search for all occurrences

void setDefaultSectionSize | ( | int | size | ) |

Search for all occurrences

int minimumSectionSize | ( |  | ) | const

Search for all occurrences

void setMinimumSectionSize | ( | int | size | ) |

Search for all occurrences

Qt::Alignment defaultAlignment | ( |  | ) | const

Search for all occurrences

void setDefaultAlignment | ( | Qt::Alignment | alignment | ) |

Search for all occurrences

void doItemsLayout | ( |  | ) | `[virtual]`

Search for all occurrences

Reimplemented from QAbstractItemView.

bool sectionsMoved | ( |  | ) | const

Search for all occurrences

bool sectionsHidden | ( |  | ) | const

Search for all occurrences

QByteArray saveState | ( |  | ) | const

Search for all occurrences

bool restoreState | ( | const QByteArray & | state | ) |

Search for all occurrences

void reset | ( |  | ) | `[virtual]`

Search for all occurrences

Reimplemented from QAbstractItemView.

void setOffset | ( | int | offset | ) | `[slot]`

Search for all occurrences

void setOffsetToSectionPosition | ( | int | visualIndex | ) | `[slot]`

Search for all occurrences

void setOffsetToLastSection | ( |  | ) | `[slot]`

Search for all occurrences

void headerDataChanged | ( | Qt::Orientation | orientation,
|  | int | logicalFirst,
|  | int | logicalLast
| ) |  | `[slot]`

Search for all occurrences

void sectionMoved | ( | int | logicalIndex,
|  | int | oldVisualIndex,
|  | int | newVisualIndex
| ) |  | `[signal]`

Search for all occurrences

void sectionResized | ( | int | logicalIndex,
|  | int | oldSize,
|  | int | newSize
| ) |  | `[signal]`

Search for all occurrences

void sectionPressed | ( | int | logicalIndex | ) | `[signal]`

Search for all occurrences

void sectionClicked | ( | int | logicalIndex | ) | `[signal]`

Search for all occurrences

void sectionEntered | ( | int | logicalIndex | ) | `[signal]`

Search for all occurrences

void sectionDoubleClicked | ( | int | logicalIndex | ) | `[signal]`

Search for all occurrences

void sectionCountChanged | ( | int | oldCount,
|  | int | newCount
| ) |  | `[signal]`

Search for all occurrences

void sectionHandleDoubleClicked | ( | int | logicalIndex | ) | `[signal]`

Search for all occurrences

void sectionAutoResize | ( | int | logicalIndex,
|  | QHeaderView::ResizeMode | mode
| ) |  | `[signal]`

Search for all occurrences

void geometriesChanged | ( |  | ) | `[signal]`

Search for all occurrences

void sortIndicatorChanged | ( | int | logicalIndex,
|  | Qt::SortOrder | order
| ) |  | `[signal]`

Search for all occurrences

void updateSection | ( | int | logicalIndex | ) | `[protected, slot]`

Search for all occurrences

void resizeSections | ( |  | ) | `[protected, slot]`

Search for all occurrences

void sectionsInserted | ( | const QModelIndex & | parent,
|  | int | logicalFirst,
|  | int | logicalLast
| ) |  | `[protected, slot]`

Search for all occurrences

void sectionsAboutToBeRemoved | ( | const QModelIndex & | parent,
|  | int | logicalFirst,
|  | int | logicalLast
| ) |  | `[protected, slot]`

Search for all occurrences

void initialize | ( |  | ) | `[protected]`

Search for all occurrences

void initializeSections | ( |  | ) | `[protected]`

Search for all occurrences

void initializeSections | ( | int | start,
|  | int | end
| ) |  | `[protected]`

Search for all occurrences

void currentChanged | ( | const QModelIndex & | current,
|  | const QModelIndex & | old
| ) |  | `[protected, virtual]`

Search for all occurrences

Reimplemented from QAbstractItemView.

bool event | ( | QEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QAbstractItemView.

void paintEvent | ( | QPaintEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QAbstractScrollArea.

void mousePressEvent | ( | QMouseEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QAbstractItemView.

void mouseMoveEvent | ( | QMouseEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QAbstractItemView.

void mouseReleaseEvent | ( | QMouseEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QAbstractItemView.

void mouseDoubleClickEvent | ( | QMouseEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QAbstractItemView.

bool viewportEvent | ( | QEvent * | e | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QAbstractItemView.

virtual void paintSection | ( | QPainter * | painter,
|  | const QRect & | rect,
|  | int | logicalIndex
| ) |  | const `[protected, virtual]`

Search for all occurrences

virtual QSize sectionSizeFromContents | ( | int | logicalIndex | ) | const `[protected, virtual]`

Search for all occurrences

int horizontalOffset | ( |  | ) | const `[protected, virtual]`

Search for all occurrences

Implements QAbstractItemView.

int verticalOffset | ( |  | ) | const `[protected, virtual]`

Search for all occurrences

Implements QAbstractItemView.

void updateGeometries | ( |  | ) | `[protected, virtual]`

Search for all occurrences

Reimplemented from QAbstractItemView.

void scrollContentsBy | ( | int | dx,
|  | int | dy
| ) |  | `[protected, virtual]`

Search for all occurrences

Reimplemented from QAbstractScrollArea.

void dataChanged | ( | const QModelIndex & | topLeft,
|  | const QModelIndex & | bottomRight
| ) |  | `[protected, virtual]`

Search for all occurrences

Reimplemented from QAbstractItemView.

void rowsInserted | ( | const QModelIndex & | parent,
|  | int | start,
|  | int | end
| ) |  | `[protected, virtual]`

Search for all occurrences

Reimplemented from QAbstractItemView.

QRect visualRect | ( | const QModelIndex & | index | ) | const `[protected, virtual]`

Search for all occurrences

Implements QAbstractItemView.

void scrollTo | ( | const QModelIndex & | index,
|  | ScrollHint | hint
| ) |  | `[protected, virtual]`

Search for all occurrences

Implements QAbstractItemView.

QModelIndex indexAt | ( | const QPoint & | p | ) | const `[protected, virtual]`

Search for all occurrences

Implements QAbstractItemView.

bool isIndexHidden | ( | const QModelIndex & | index | ) | const `[protected, virtual]`

Search for all occurrences

Implements QAbstractItemView.

QModelIndex moveCursor | ( | CursorAction | ,
|  | Qt::KeyboardModifiers |
| ) |  | `[protected, virtual]`

Search for all occurrences

Implements QAbstractItemView.

void setSelection | ( | const QRect & | rect,
|  | QItemSelectionModel::SelectionFlags | flags
| ) |  | `[protected, virtual]`

Search for all occurrences

Implements QAbstractItemView.

QRegion visualRegionForSelection | ( | const QItemSelection & | selection | ) | const `[protected, virtual]`

Search for all occurrences

Implements QAbstractItemView.

void initStyleOption | ( | QStyleOptionHeader * | option | ) | const `[protected]`

Search for all occurrences

## Property Documentation

bool showSortIndicator `[read, write]`

Search for all occurrences

Definition at line 61 of file qheaderview.h.

bool highlightSections `[read, write]`

Search for all occurrences

Definition at line 62 of file qheaderview.h.

bool stretchLastSection `[read, write]`

Search for all occurrences

Definition at line 63 of file qheaderview.h.

bool cascadingSectionResizes `[read, write]`

Search for all occurrences

Definition at line 64 of file qheaderview.h.

int defaultSectionSize `[read, write]`

Search for all occurrences

Definition at line 65 of file qheaderview.h.

int minimumSectionSize `[read, write]`

Search for all occurrences

Definition at line 66 of file qheaderview.h.

Qt::Alignment defaultAlignment `[read, write]`

Search for all occurrences

Definition at line 67 of file qheaderview.h.

The documentation for this class was generated from the following file:

- QtGui/qheaderview.h

QHeaderView QHeaderView QHeaderView QHeaderView QHeaderView QHeaderView QHeaderView QHeaderView QHeaderView QHeaderView
QHeaderView QHeaderView QHeaderView QHeaderView QHeaderView QHeaderView QHeaderView QHeaderView QHeaderView QHeaderView