CopperSpice API  1.9.2
QHeaderView Class Reference

Provides headers for item views. More...

Inheritance diagram for QHeaderView:
QAbstractItemView QAbstractScrollArea QFrame QWidget QObject QPaintDevice

Public Types

enum  ResizeMode
 
- Public Types inherited from QAbstractItemView
enum  DragDropMode
 
enum  EditTrigger
 
enum  ScrollHint
 
enum  ScrollMode
 
enum  SelectionBehavior
 
enum  SelectionMode
 
- Public Types inherited from QFrame
enum  Shadow
 
enum  Shape
 
enum  StyleMask
 
- Public Types inherited from QWidget
enum  RenderFlag
 
- Public Types inherited from QPaintDevice
enum  PaintDeviceMetric
 

Public Signals

void geometriesChanged ()
 
void sectionClicked (int logicalIndex)
 
void sectionCountChanged (int oldCount, int newCount)
 
void sectionDoubleClicked (int logicalIndex)
 
void sectionEntered (int logicalIndex)
 
void sectionHandleDoubleClicked (int logicalIndex)
 
void sectionMoved (int logicalIndex, int oldVisualIndex, int newVisualIndex)
 
void sectionPressed (int logicalIndex)
 
void sectionResized (int logicalIndex, int oldSize, int newSize)
 
void sortIndicatorChanged (int logicalIndex, Qt::SortOrder order)
 
- Public Signals inherited from QAbstractItemView
void activated (const QModelIndex &index)
 
void clicked (const QModelIndex &index)
 
void doubleClicked (const QModelIndex &index)
 
void entered (const QModelIndex &index)
 
void iconSizeChanged (const QSize &size)
 
void pressed (const QModelIndex &index)
 
void viewportEntered ()
 
- Public Signals inherited from QWidget
void customContextMenuRequested (const QPoint &pos)
 
void windowIconChanged (const QIcon &icon)
 
void windowIconTextChanged (const QString &iconText)
 
void windowTitleChanged (const QString &title)
 
- Public Signals inherited from QObject
void destroyed (QObject *obj=nullptr)
 
void objectNameChanged (const QString &objectName)
 

Public Slots

void headerDataChanged (Qt::Orientation orientation, int logicalFirst, int logicalLast)
 
void setOffset (int offset)
 
void setOffsetToLastSection ()
 
void setOffsetToSectionPosition (int visualIndex)
 
- Public Slots inherited from QAbstractItemView
void clearSelection ()
 
void edit (const QModelIndex &index)
 
virtual void reset ()
 
void scrollToBottom ()
 
void scrollToTop ()
 
virtual void selectAll ()
 
void setCurrentIndex (const QModelIndex &index)
 
virtual void setRootIndex (const QModelIndex &index)
 
void update (const QModelIndex &index)
 
- Public Slots inherited from QWidget
bool close ()
 
void hide ()
 
void lower ()
 
void raise ()
 
void repaint ()
 
void setDisabled (bool disable)
 
void setEnabled (bool enable)
 
void setFocus ()
 
void setHidden (bool hidden)
 
void setStyleSheet (const QString &styleSheet)
 
virtual void setVisible (bool visible)
 
void setWindowModified (bool modified)
 
void setWindowTitle (const QString &title)
 
void show ()
 
void showFullScreen ()
 
void showMaximized ()
 
void showMinimized ()
 
void showNormal ()
 
void update ()
 
- Public Slots inherited from QObject
void deleteLater ()
 

Public Methods

 QHeaderView (Qt::Orientation orientation, QWidget *parent=nullptr)
 
virtual ~QHeaderView ()
 
bool cascadingSectionResizes () const
 
int count () const
 
Qt::Alignment defaultAlignment () const
 
int defaultSectionSize () const
 
int hiddenSectionCount () const
 
void hideSection (int logicalIndex)
 
bool highlightSections () const
 
bool isSectionHidden (int logicalIndex) const
 
bool isSortIndicatorShown () const
 
int length () const
 
int logicalIndex (int visualIndex) const
 
int logicalIndexAt (const QPoint &pos) const
 
int logicalIndexAt (int position) const
 
int logicalIndexAt (int x, int y) const
 
int maximumSectionSize () const
 
int minimumSectionSize () const
 
void moveSection (int from, int to)
 
int offset () const
 
Qt::Orientation orientation () const
 
void reset () override
 
void resetDefaultSectionSize ()
 
int resizeContentsPrecision () const
 
void resizeSection (int logicalIndex, int size)
 
void resizeSections (QHeaderView::ResizeMode mode)
 
bool restoreState (const QByteArray &state)
 
QByteArray saveState () const
 
int sectionPosition (int logicalIndex) const
 
ResizeMode sectionResizeMode (int logicalIndex) const
 
bool sectionsClickable () const
 
bool sectionsHidden () const
 
int sectionSize (int logicalIndex) const
 
int sectionSizeHint (int logicalIndex) const
 
bool sectionsMovable () const
 
bool sectionsMoved () const
 
int sectionViewportPosition (int logicalIndex) const
 
void setCascadingSectionResizes (bool enable)
 
void setDefaultAlignment (Qt::Alignment alignment)
 
void setDefaultSectionSize (int size)
 
void setHighlightSections (bool highlight)
 
void setMaximumSectionSize (int size)
 
void setMinimumSectionSize (int size)
 
void setModel (QAbstractItemModel *model) override
 
void setResizeContentsPrecision (int precision)
 
void setSectionHidden (int logicalIndex, bool hide)
 
void setSectionResizeMode (int logicalIndex, ResizeMode mode)
 
void setSectionResizeMode (ResizeMode mode)
 
void setSectionsClickable (bool clickable)
 
void setSectionsMovable (bool movable)
 
void setSortIndicator (int logicalIndex, Qt::SortOrder order)
 
void setSortIndicatorShown (bool show)
 
void setStretchLastSection (bool stretch)
 
void setVisible (bool visible) override
 
void showSection (int logicalIndex)
 
QSize sizeHint () const override
 
Qt::SortOrder sortIndicatorOrder () const
 
int sortIndicatorSection () const
 
bool stretchLastSection () const
 
int stretchSectionCount () const
 
void swapSections (int first, int second)
 
int visualIndex (int logicalIndex) const
 
int visualIndexAt (int position) const
 
- Public Methods inherited from QAbstractItemView
 QAbstractItemView (QWidget *parent=nullptr)
 
 ~QAbstractItemView ()
 
bool alternatingRowColors () const
 
int autoScrollMargin () const
 
void closePersistentEditor (const QModelIndex &index)
 
QModelIndex currentIndex () const
 
Qt::DropAction defaultDropAction () const
 
DragDropMode dragDropMode () const
 
bool dragDropOverwriteMode () const
 
bool dragEnabled () const
 
EditTriggers editTriggers () const
 
bool hasAutoScroll () const
 
ScrollMode horizontalScrollMode () const
 
QSize iconSize () const
 
QWidgetindexWidget (const QModelIndex &index) const
 
QVariant inputMethodQuery (Qt::InputMethodQuery query) const override
 
QAbstractItemDelegateitemDelegate () const
 
QAbstractItemDelegateitemDelegate (const QModelIndex &index) const
 
QAbstractItemDelegateitemDelegateForColumn (int column) const
 
QAbstractItemDelegateitemDelegateForRow (int row) const
 
virtual void keyboardSearch (const QString &search)
 
QAbstractItemModelmodel () const
 
void openPersistentEditor (const QModelIndex &index)
 
QModelIndex rootIndex () const
 
QAbstractItemView::SelectionBehavior selectionBehavior () const
 
QAbstractItemView::SelectionMode selectionMode () const
 
QItemSelectionModelselectionModel () const
 
void setAlternatingRowColors (bool enable)
 
void setAutoScroll (bool enable)
 
void setAutoScrollMargin (int margin)
 
void setDefaultDropAction (Qt::DropAction dropAction)
 
void setDragDropMode (DragDropMode behavior)
 
void setDragDropOverwriteMode (bool overwrite)
 
void setDragEnabled (bool enable)
 
void setDropIndicatorShown (bool enable)
 
void setEditTriggers (EditTriggers triggers)
 
void setHorizontalScrollMode (ScrollMode mode)
 
void setIconSize (const QSize &size)
 
void setIndexWidget (const QModelIndex &index, QWidget *widget)
 
void setItemDelegate (QAbstractItemDelegate *delegate)
 
void setItemDelegateForColumn (int column, QAbstractItemDelegate *delegate)
 
void setItemDelegateForRow (int row, QAbstractItemDelegate *delegate)
 
void setSelectionBehavior (QAbstractItemView::SelectionBehavior behavior)
 
void setSelectionMode (QAbstractItemView::SelectionMode mode)
 
virtual void setSelectionModel (QItemSelectionModel *selectionModel)
 
void setTabKeyNavigation (bool enable)
 
void setTextElideMode (Qt::TextElideMode mode)
 
void setVerticalScrollMode (ScrollMode mode)
 
bool showDropIndicator () const
 
virtual int sizeHintForColumn (int column) const
 
QSize sizeHintForIndex (const QModelIndex &index) const
 
virtual int sizeHintForRow (int row) const
 
bool tabKeyNavigation () const
 
Qt::TextElideMode textElideMode () const
 
ScrollMode verticalScrollMode () const
 
- Public Methods inherited from QAbstractScrollArea
 QAbstractScrollArea (QWidget *parent=nullptr)
 
 ~QAbstractScrollArea ()
 
void addScrollBarWidget (QWidget *widget, Qt::Alignment alignment)
 
QWidgetcornerWidget () const
 
QScrollBarhorizontalScrollBar () const
 
Qt::ScrollBarPolicy horizontalScrollBarPolicy () const
 
QSize maximumViewportSize () const
 
QSize minimumSizeHint () const override
 
QWidgetList scrollBarWidgets (Qt::Alignment alignment)
 
void setCornerWidget (QWidget *widget)
 
void setHorizontalScrollBar (QScrollBar *scrollBar)
 
void setHorizontalScrollBarPolicy (Qt::ScrollBarPolicy policy)
 
void setSizeAdjustPolicy (SizeAdjustPolicy policy)
 
virtual void setupViewport (QWidget *viewport)
 
void setVerticalScrollBar (QScrollBar *scrollBar)
 
void setVerticalScrollBarPolicy (Qt::ScrollBarPolicy policy)
 
void setViewport (QWidget *widget)
 
SizeAdjustPolicy sizeAdjustPolicy () const
 
QSize sizeHint () const override
 
QScrollBarverticalScrollBar () const
 
Qt::ScrollBarPolicy verticalScrollBarPolicy () const
 
QWidgetviewport () const
 
- Public Methods inherited from QFrame
 QFrame (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
 ~QFrame ()
 
QRect frameRect () const
 
Shadow frameShadow () const
 
Shape frameShape () const
 
int frameStyle () const
 
int frameWidth () const
 
int lineWidth () const
 
int midLineWidth () const
 
void setFrameRect (const QRect &rect)
 
void setFrameShadow (Shadow value)
 
void setFrameShape (Shape value)
 
void setFrameStyle (int style)
 
void setLineWidth (int width)
 
void setMidLineWidth (int width)
 
QSize sizeHint () const override
 
- Public Methods inherited from QWidget
 QWidget (QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
 ~QWidget ()
 
bool acceptDrops () const
 
QString accessibleDescription () const
 
QString accessibleName () const
 
QList< QAction * > actions () const
 
void activateWindow ()
 
void addAction (QAction *action)
 
void addActions (const QList< QAction * > &actions)
 
void adjustSize ()
 
bool autoFillBackground () const
 
QPalette::ColorRole backgroundRole () const
 
QBackingStorebackingStore () const
 
QSize baseSize () const
 
QWidget * childAt (const QPoint &position) const
 
QWidget * childAt (int x, int y) const
 
QRect childrenRect () const
 
QRegion childrenRegion () const
 
void clearFocus ()
 
void clearMask ()
 
QMargins contentsMargins () const
 
QRect contentsRect () const
 
Qt::ContextMenuPolicy contextMenuPolicy () const
 
QCursor cursor () const
 
WId effectiveWinId () const
 
void ensurePolished () const
 
Qt::FocusPolicy focusPolicy () const
 
QWidget * focusProxy () const
 
QWidget * focusWidget () const
 
const QFontfont () const
 
QFontInfo fontInfo () const
 
QFontMetrics fontMetrics () const
 
QPalette::ColorRole foregroundRole () const
 
QRect frameGeometry () const
 
QSize frameSize () const
 
const QRectgeometry () const
 
void getContentsMargins (int *left, int *top, int *right, int *bottom) const
 
QPixmap grab (const QRect &rectangle=QRect (QPoint (0, 0), QSize (-1,-1)))
 
void grabGesture (Qt::GestureType gestureType, Qt::GestureFlags flags=Qt::GestureFlags ())
 
void grabKeyboard ()
 
void grabMouse ()
 
void grabMouse (const QCursor &cursor)
 
int grabShortcut (const QKeySequence &key, Qt::ShortcutContext context=Qt::WindowShortcut)
 
QGraphicsEffectgraphicsEffect () const
 
QGraphicsProxyWidgetgraphicsProxyWidget () const
 
bool hasEditFocus () const
 
bool hasFocus () const
 
virtual bool hasHeightForWidth () const
 
bool hasMouseTracking () const
 
int height () const
 
virtual int heightForWidth (int width) const
 
Qt::InputMethodHints inputMethodHints () const
 
void insertAction (QAction *before, QAction *action)
 
void insertActions (QAction *before, QList< QAction * > actions)
 
bool isActiveWindow () const
 
bool isAncestorOf (const QWidget *child) const
 
bool isEnabled () const
 
bool isEnabledTo (const QWidget *parent) const
 
bool isEnabledToTLW () const
 
bool isFullScreen () const
 
bool isHidden () const
 
bool isMaximized () const
 
bool isMinimized () const
 
bool isModal () const
 
bool isTopLevel () const
 
bool isVisible () const
 
bool isVisibleTo (const QWidget *parent) const
 
bool isWindow () const
 
bool isWindowModified () const
 
QLayoutlayout () const
 
Qt::LayoutDirection layoutDirection () const
 
QLocale locale () const
 
QPoint mapFrom (const QWidget *parent, const QPoint &pos) const
 
QPoint mapFromGlobal (const QPoint &pos) const
 
QPoint mapFromParent (const QPoint &pos) const
 
QPoint mapTo (const QWidget *parent, const QPoint &pos) const
 
QPoint mapToGlobal (const QPoint &pos) const
 
QPoint mapToParent (const QPoint &pos) const
 
QRegion mask () const
 
int maximumHeight () const
 
QSize maximumSize () const
 
int maximumWidth () const
 
int minimumHeight () const
 
QSize minimumSize () const
 
int minimumWidth () const
 
void move (const QPoint &point)
 
void move (int x, int y)
 
QWidget * nativeParentWidget () const
 
QWidget * nextInFocusChain () const
 
QRect normalGeometry () const
 
void overrideWindowFlags (Qt::WindowFlags flags)
 
QPaintEnginepaintEngine () const override
 
const QPalettepalette () const
 
QWidget * parentWidget () const
 
QPoint pos () const
 
QWidget * previousInFocusChain () const
 
QRect rect () const
 
void releaseKeyboard ()
 
void releaseMouse ()
 
void releaseShortcut (int id)
 
void removeAction (QAction *action)
 
void render (QPaintDevice *target, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
 
void render (QPainter *painter, const QPoint &targetOffset=QPoint (), const QRegion &sourceRegion=QRegion (), RenderFlags renderFlags=RenderFlags (DrawWindowBackground|DrawChildren))
 
void repaint (const QRect &rect)
 
void repaint (const QRegion &region)
 
void repaint (int x, int y, int w, int h)
 
void resize (const QSize &size)
 
void resize (int w, int h)
 
bool restoreGeometry (const QByteArray &geometry)
 
QByteArray saveGeometry () const
 
void scroll (int dx, int dy)
 
void scroll (int dx, int dy, const QRect &rect)
 
void setAcceptDrops (bool on)
 
void setAccessibleDescription (const QString &description)
 
void setAccessibleName (const QString &name)
 
void setAttribute (Qt::WidgetAttribute attribute, bool enable=true)
 
void setAutoFillBackground (bool enable)
 
void setBackgroundRole (QPalette::ColorRole role)
 
void setBaseSize (const QSize &size)
 
void setBaseSize (int basew, int baseh)
 
void setContentsMargins (const QMargins &margins)
 
void setContentsMargins (int left, int top, int right, int bottom)
 
void setContextMenuPolicy (Qt::ContextMenuPolicy policy)
 
void setCursor (const QCursor &cursor)
 
void setEditFocus (bool enable)
 
void setFixedHeight (int h)
 
void setFixedSize (const QSize &size)
 
void setFixedSize (int w, int h)
 
void setFixedWidth (int w)
 
void setFocus (Qt::FocusReason reason)
 
void setFocusPolicy (Qt::FocusPolicy policy)
 
void setFocusProxy (QWidget *widget)
 
void setFont (const QFont &font)
 
void setForegroundRole (QPalette::ColorRole role)
 
void setGeometry (const QRect &rect)
 
void setGeometry (int x, int y, int w, int h)
 
void setGraphicsEffect (QGraphicsEffect *effect)
 
void setInputMethodHints (Qt::InputMethodHints hints)
 
void setLayout (QLayout *layout)
 
void setLayoutDirection (Qt::LayoutDirection direction)
 
void setLocale (const QLocale &locale)
 
void setMask (const QBitmap &bitmap)
 
void setMask (const QRegion &region)
 
void setMaximumHeight (int maxh)
 
void setMaximumSize (const QSize &size)
 
void setMaximumSize (int maxw, int maxh)
 
void setMaximumWidth (int maxw)
 
void setMinimumHeight (int minh)
 
void setMinimumSize (const QSize &size)
 
void setMinimumSize (int minw, int minh)
 
void setMinimumWidth (int minw)
 
void setMouseTracking (bool enable)
 
void setPalette (const QPalette &palette)
 
void setParent (QWidget *parent)
 
void setParent (QWidget *parent, Qt::WindowFlags flags)
 
void setShortcutAutoRepeat (int id, bool enable=true)
 
void setShortcutEnabled (int id, bool enable=true)
 
void setSizeIncrement (const QSize &size)
 
void setSizeIncrement (int w, int h)
 
void setSizePolicy (QSizePolicy policy)
 
void setSizePolicy (QSizePolicy::Policy horizontal, QSizePolicy::Policy vertical)
 
void setStatusTip (const QString &data)
 
void setStyle (QStyle *style)
 
void setToolTip (const QString &data)
 
void setToolTipDuration (int msec)
 
void setUpdatesEnabled (bool enable)
 
void setWhatsThis (const QString &str)
 
void setWindowFilePath (const QString &filePath)
 
void setWindowFlags (Qt::WindowFlags flags)
 
void setWindowIcon (const QIcon &icon)
 
void setWindowModality (Qt::WindowModality windowModality)
 
void setWindowOpacity (qreal level)
 
void setWindowRole (const QString &role)
 
void setWindowState (Qt::WindowStates windowState)
 
QSize size () const
 
QSize sizeIncrement () const
 
QSizePolicy sizePolicy () const
 
void stackUnder (QWidget *widget)
 
QString statusTip () const
 
QStylestyle () const
 
QString styleSheet () const
 
bool testAttribute (Qt::WidgetAttribute attribute) const
 
QString toolTip () const
 
int toolTipDuration () const
 
QWidget * topLevelWidget () const
 
bool underMouse () const
 
void ungrabGesture (Qt::GestureType gestureType)
 
void unsetCursor ()
 
void unsetLayoutDirection ()
 
void unsetLocale ()
 
void update (const QRect &rect)
 
void update (const QRegion &region)
 
void update (int x, int y, int w, int h)
 
void updateGeometry ()
 
bool updatesEnabled () const
 
QRegion visibleRegion () const
 
QString whatsThis () const
 
int width () const
 
QWidget * window () const
 
QString windowFilePath () const
 
Qt::WindowFlags windowFlags () const
 
QWindowwindowHandle () const
 
QIcon windowIcon () const
 
Qt::WindowModality windowModality () const
 
qreal windowOpacity () const
 
QString windowRole () const
 
Qt::WindowStates windowState () const
 
QString windowTitle () const
 
Qt::WindowType windowType () const
 
WId winId () const
 
int x () const
 
int y () const
 
- Public Methods inherited from QObject
 QObject (QObject *parent=nullptr)
 
 ~QObject ()
 
bool blockSignals (bool block)
 
const QList< QObject * > & children () const
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool connect (const QObject *sender, const QString &signalMethod, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
bool disconnect (const QObject *receiver, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod, const QString &location, const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
bool disconnect (const QString &signalMethod=QString (), const QObject *receiver=nullptr, const QString &slotMethod=QString ()) const
 
void dumpObjectInfo ()
 
void dumpObjectTree ()
 
QList< QStringdynamicPropertyNames () const
 
virtual bool event (QEvent *event)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
template<typename T >
findChild (const QString &childName=QString ()) const
 
template<class T >
QList< T > findChildren (const QRegularExpression &regExp, Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
template<class T >
QList< T > findChildren (const QString &childName=QString (), Qt::FindChildOptions options=Qt::FindChildrenRecursively) const
 
bool inherits (const QString &className) const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const
 
bool isWindowType () const
 
void killTimer (int id)
 
const QMetaObjectmetaObject () const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const
 
QObject * parent () const
 
template<class T = QVariant>
property (const QString &name) const
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const QString &name, const QVariant &value)
 
bool signalsBlocked () const
 
int startTimer (int interval, Qt::TimerType timerType=Qt::CoarseTimer)
 
QThreadthread () const
 
- Public Methods inherited from QPaintDevice
virtual ~QPaintDevice ()
 
int colorCount () const
 
int depth () const
 
int devicePixelRatio () const
 
qreal devicePixelRatioF () const
 
int height () const
 
int heightMM () const
 
int logicalDpiX () const
 
int logicalDpiY () const
 
bool paintingActive () const
 
int physicalDpiX () const
 
int physicalDpiY () const
 
int width () const
 
int widthMM () const
 

Protected Slots

void resizeSections ()
 
void sectionsAboutToBeRemoved (const QModelIndex &parent, int logicalFirst, int logicalLast)
 
void sectionsInserted (const QModelIndex &parent, int logicalFirst, int logicalLast)
 
- Protected Slots inherited from QAbstractItemView
virtual void closeEditor (QWidget *editor, QAbstractItemDelegate::EndEditHint hint)
 
virtual void commitData (QWidget *editor)
 
virtual void currentChanged (const QModelIndex &current, const QModelIndex &previous)
 
virtual void dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector< int > &roles=QVector< int >())
 
virtual void editorDestroyed (QObject *editor)
 
virtual void rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end)
 
virtual void rowsInserted (const QModelIndex &parent, int start, int end)
 
virtual void selectionChanged (const QItemSelection &selected, const QItemSelection &deselected)
 
virtual void updateGeometries ()
 
- Protected Slots inherited from QWidget
void updateMicroFocus ()
 

Protected Methods

void currentChanged (const QModelIndex &current, const QModelIndex &old) override
 
bool event (QEvent *event) override
 
int horizontalOffset () const override
 
QModelIndex indexAt (const QPoint &p) const override
 
void initStyleOption (QStyleOptionHeader *option) const
 
bool isIndexHidden (const QModelIndex &index) const override
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
QModelIndex moveCursor (CursorAction, Qt::KeyboardModifiers) override
 
void paintEvent (QPaintEvent *event) override
 
virtual void paintSection (QPainter *painter, const QRect &rect, int logicalIndex) const
 
void scrollContentsBy (int dx, int dy) override
 
void scrollTo (const QModelIndex &index, ScrollHint hint) override
 
virtual QSize sectionSizeFromContents (int logicalIndex) const
 
void setSelection (const QRect &rect, QItemSelectionModel::SelectionFlags flags) override
 
int verticalOffset () const override
 
bool viewportEvent (QEvent *event) override
 
QRect visualRect (const QModelIndex &index) const override
 
QRegion visualRegionForSelection (const QItemSelection &selection) const override
 
- Protected Methods inherited from QAbstractItemView
QPoint dirtyRegionOffset () const
 
void dragEnterEvent (QDragEnterEvent *event) override
 
void dragLeaveEvent (QDragLeaveEvent *event) override
 
void dragMoveEvent (QDragMoveEvent *event) override
 
void dropEvent (QDropEvent *event) override
 
DropIndicatorPosition dropIndicatorPosition () const
 
virtual bool edit (const QModelIndex &index, EditTrigger trigger, QEvent *event)
 
bool event (QEvent *event) override
 
void executeDelayedItemsLayout ()
 
void focusInEvent (QFocusEvent *event) override
 
bool focusNextPrevChild (bool next) override
 
void focusOutEvent (QFocusEvent *event) override
 
int horizontalStepsPerItem () const
 
void inputMethodEvent (QInputMethodEvent *event) override
 
void keyPressEvent (QKeyEvent *event) override
 
void resizeEvent (QResizeEvent *event) override
 
void scheduleDelayedItemsLayout ()
 
void scrollDirtyRegion (int dx, int dy)
 
virtual QModelIndexList selectedIndexes () const
 
virtual QItemSelectionModel::SelectionFlags selectionCommand (const QModelIndex &index, const QEvent *event=nullptr) const
 
void setDirtyRegion (const QRegion &region)
 
void setHorizontalStepsPerItem (int steps)
 
void setState (State state)
 
void setVerticalStepsPerItem (int steps)
 
virtual void startDrag (Qt::DropActions supportedActions)
 
State state () const
 
void timerEvent (QTimerEvent *event) override
 
int verticalStepsPerItem () const
 
virtual QStyleOptionViewItem viewOptions () const
 
QSize viewportSizeHint () const override
 
- Protected Methods inherited from QAbstractScrollArea
void contextMenuEvent (QContextMenuEvent *event) override
 
void dragEnterEvent (QDragEnterEvent *event) override
 
void dragLeaveEvent (QDragLeaveEvent *event) override
 
void dragMoveEvent (QDragMoveEvent *event) override
 
void dropEvent (QDropEvent *event) override
 
bool event (QEvent *event) override
 
void keyPressEvent (QKeyEvent *event) override
 
void mouseDoubleClickEvent (QMouseEvent *event) override
 
void mouseMoveEvent (QMouseEvent *event) override
 
void mousePressEvent (QMouseEvent *event) override
 
void mouseReleaseEvent (QMouseEvent *event) override
 
void paintEvent (QPaintEvent *event) override
 
void resizeEvent (QResizeEvent *event) override
 
void setViewportMargins (const QMargins &margins)
 
void setViewportMargins (int left, int top, int right, int bottom)
 
QMargins viewportMargins () const
 
void wheelEvent (QWheelEvent *event) override
 
- Protected Methods inherited from QFrame
void changeEvent (QEvent *event) override
 
void drawFrame (QPainter *painter)
 
bool event (QEvent *event) override
 
void initStyleOption (QStyleOptionFrame *option) const
 
void paintEvent (QPaintEvent *event) override
 
- Protected Methods inherited from QWidget
virtual void actionEvent (QActionEvent *event)
 
virtual void closeEvent (QCloseEvent *event)
 
void create (WId window=0, bool initializeWindow=true, bool destroyOldWindow=true)
 
void destroy (bool destroyWindow=true, bool destroySubWindows=true)
 
virtual void enterEvent (QEvent *event)
 
bool event (QEvent *event) override
 
bool focusNextChild ()
 
bool focusPreviousChild ()
 
virtual void hideEvent (QHideEvent *event)
 
void initPainter (QPainter *painter) const override
 
virtual void keyReleaseEvent (QKeyEvent *event)
 
virtual void leaveEvent (QEvent *event)
 
int metric (PaintDeviceMetric metric) const override
 
virtual void moveEvent (QMoveEvent *event)
 
virtual bool nativeEvent (const QByteArray &eventType, void *message, long *result)
 
virtual void showEvent (QShowEvent *event)
 
virtual void tabletEvent (QTabletEvent *event)
 
- Protected Methods inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signalMethod) const
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signalMethod) const
 
bool isSignalConnected (const QMetaMethod &signalMethod) const
 
int receivers (const QString &signal) const
 
QObject * sender () const
 
int senderSignalIndex () const
 
virtual void timerEvent (QTimerEvent *event)
 
- Protected Methods inherited from QPaintDevice
 QPaintDevice ()
 

Properties

 cascadingSectionResizes
 
 defaultAlignment
 
 defaultSectionSize
 
 highlightSections
 
 maximumSectionSize
 
 minimumSectionSize
 
 showSortIndicator
 
 stretchLastSection
 
- Properties inherited from QAbstractItemView
 alternatingRowColors
 
 autoScroll
 
 autoScrollMargin
 
 defaultDropAction
 
 dragDropMode
 
 dragDropOverwriteMode
 
 dragEnabled
 
 editTriggers
 
 horizontalScrollMode
 
 iconSize
 
 selectionBehavior
 
 selectionMode
 
 showDropIndicator
 
 tabKeyNavigation
 
 textElideMode
 
 verticalScrollMode
 
- Properties inherited from QAbstractScrollArea
 horizontalScrollBarPolicy
 
 verticalScrollBarPolicy
 
- Properties inherited from QFrame
 frameRect
 
 frameShadow
 
 frameShape
 
 frameWidth
 
 lineWidth
 
 midLineWidth
 
- Properties inherited from QWidget
 acceptDrops
 
 accessibleDescription
 
 accessibleName
 
 autoFillBackground
 
 baseSize
 
 childrenRect
 
 childrenRegion
 
 contextMenuPolicy
 
 cursor
 
 enabled
 
 focus
 
 focusPolicy
 
 font
 
 frameGeometry
 
 frameSize
 
 fullScreen
 
 geometry
 
 height
 
 inputMethodHints
 
 isActiveWindow
 
 layoutDirection
 
 locale
 
 maximized
 
 maximumHeight
 
 maximumSize
 
 maximumWidth
 
 minimized
 
 minimumHeight
 
 minimumSize
 
 minimumSizeHint
 
 minimumWidth
 
 modal
 
 mouseTracking
 
 normalGeometry
 
 palette
 
 pos
 
 rect
 
 size
 
 sizeHint
 
 sizeIncrement
 
 sizePolicy
 
 statusTip
 
 styleSheet
 
 toolTip
 
 updatesEnabled
 
 visible
 
 whatsThis
 
 width
 
 windowFilePath
 
 windowFlags
 
 windowIcon
 
 windowIconText
 
 windowModality
 
 windowModified
 
 windowOpacity
 
 windowTitle
 
 x
 
 y
 
- Properties inherited from QObject
 objectName
 

Friends

class QTableView
 
class QTreeView
 

Additional Inherited Members

- Public Typedefs inherited from QAbstractItemView
using EditTriggers = QFlags< EditTrigger >
 
- Public Typedefs inherited from QWidget
using RenderFlags = QFlags< RenderFlag >
 
- Static Public Methods inherited from QWidget
static QWidget * createWindowContainer (QWindow *window, QWidget *parent=nullptr, Qt::WindowFlags flags=Qt::EmptyFlag)
 
static QWidget * find (WId id)
 
static QWidget * keyboardGrabber ()
 
static QWidget * mouseGrabber ()
 
static void setTabOrder (QWidget *firstWidget, QWidget *secondWidget)
 
- Static Public Methods inherited from QObject
static bool connect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool connect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection, const QString &location=QString ())
 
static bool connect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod, Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...), Qt::ConnectionType type=Qt::AutoConnection)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool connect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotLambda, Qt::ConnectionType type=Qt::AutoConnection)
 
static bool disconnect (const QObject *sender, const QMetaMethod &signalMethod, const QObject *receiver, const QMetaMethod &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, const QString &signalMethod, const QString &location, const QObject *receiver, const QString &slotMethod)
 
static bool disconnect (const QObject *sender, std::nullptr_t, const QObject *receiver, std::nullptr_t)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class SlotClass , class... SlotArgs, class SlotReturn >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, SlotReturn (SlotClass::*slotMethod)(SlotArgs...))
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, std::nullptr_t slotMethod=nullptr)
 
template<class Sender , class SignalClass , class... SignalArgs, class Receiver , class T >
static bool disconnect (const Sender *sender, void (SignalClass::*signalMethod)(SignalArgs...), const Receiver *receiver, T slotMethod)
 
static QMetaObjectstaticMetaObject ()
 
static QString tr (const char *text, const char *comment=nullptr, std::optional< int > numArg=std::optional< int >())
 
- Protected Types inherited from QAbstractItemView
enum  CursorAction
 
enum  DropIndicatorPosition
 
enum  State
 

Detailed Description

The QHeaderView class provides headers for item views. A header can appear vertically or horizontally. This class is used to display the headers in item view classes like QTableView and QTreeView.

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.

Moving Header Sections

A header can be fixed in place or made movable with setSectionsMovable(). It can be made clickable with setSectionsClickable() and has resizing behavior in accordance with setSectionResizeMode(). A header will emit sectionMoved() if the user moves a section, sectionResized() if the user resizes a section, and sectionClicked() as well as sectionHandleDoubleClicked() in response to mouse clicks. A header will also emit sectionCountChanged().

You can identify a section using the logicalIndex() and logicalIndexAt() functions, or by its index position, using the visualIndex() and visualIndexAt() functions. The visual index will change if a section is moved, but the logical index will not change.

Double-clicking on a header to resize a section only applies for visible rows.

Appearance

QTableWidget and QTableView create default headers. If you want the headers to be visible you can use setVisible(). Each header renders the data for each section itself and does not rely on a delegate. As a result, calling a header's setItemDelegate() method will have no effect.

Not all item data roles will have an effect on a QHeaderView. If you need to draw other roles, you can subclass QHeaderView and reimplement paintEvent(). QHeaderView respects the following item data roles: Qt::TextAlignmentRole, Qt::DisplayRole, Qt::FontRole, Qt::DecorationRole, Qt::ForegroundRole, and Qt::BackgroundRole.

See also
QListView, QTableView, QTreeView, Model/View Architecture

Member Enumeration Documentation

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().

ConstantValueDescription
QHeaderView::Interactive0The user can resize the section. The section can also be resized programmatically using resizeSection(). The section size defaults to defaultSectionSize. (Refer to cascadingSectionResizes.)
QHeaderView::Fixed2The user can not resize the section. The section can only be resized programmatically using resizeSection(). The section size defaults to defaultSectionSize.
QHeaderView::Stretch1QHeaderView will automatically resize the section to fill the available space. The size can not be changed by the user or programmatically.
QHeaderView::ResizeToContents3QHeaderView will automatically resize the section to its optimal size based on the contents of the entire column or row. The size can not be changed by the user or programmatically.

The following value is obsolete.

ConstantValueDescription
QHeaderView::Custom 2 Use Fixed instead.
See also
setSectionResizeMode(), stretchLastSection, minimumSectionSize

Constructor & Destructor Documentation

QHeaderView::QHeaderView ( Qt::Orientation  orientation,
QWidget parent = nullptr 
)
explicit

Creates a new generic header with the given orientation and parent.

QHeaderView::~QHeaderView ( )
virtual

Destroys the header.

Method Documentation

bool QHeaderView::cascadingSectionResizes ( ) const

Returns true if the cascadingSectionResizes property is set, otherwise returns false.

int QHeaderView::count ( ) const

Returns the number of sections in the header.

See also
sectionCountChanged(), length()
void QHeaderView::currentChanged ( const QModelIndex current,
const QModelIndex old 
)
overrideprotected
Qt::Alignment QHeaderView::defaultAlignment ( ) const

Returns the current value of the defaultAlignment property.

int QHeaderView::defaultSectionSize ( ) const

Returns the current value of the defaultSectionSize property.

bool QHeaderView::event ( QEvent event)
overrideprotected

Reimplemented from QAbstractItemView::event()

void QHeaderView::geometriesChanged ( )
signal

This signal is emitted when the header's geometries have changed.

void QHeaderView::headerDataChanged ( Qt::Orientation  orientation,
int  logicalFirst,
int  logicalLast 
)
slot

Updates the changed header sections with the given orientation, from logicalFirst to logicalLast inclusive.

int QHeaderView::hiddenSectionCount ( ) const

Returns the number of sections in the header that have been hidden.

See also
setSectionHidden(), isSectionHidden()
void QHeaderView::hideSection ( int  logicalIndex)
inline
bool QHeaderView::highlightSections ( ) const

Returns true if the highlightSections property is set, otherwise returns false.

int QHeaderView::horizontalOffset ( ) const
overrideprotectedvirtual

Returns the horizontal offset of the header. This is 0 for vertical headers.

See also
offset()

Implements QAbstractItemView::horizontalOffset()

QModelIndex QHeaderView::indexAt ( const QPoint point) const
overrideprotectedvirtual

Returns the model index of the item at the viewport coordinates point.

See also
visualRect()

Implements QAbstractItemView::indexAt()

void QHeaderView::initStyleOption ( QStyleOptionHeader option) const
protected

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.

See also
QStyleOption::initFrom()
bool QHeaderView::isIndexHidden ( const QModelIndex index) const
overrideprotectedvirtual

Returns true if the item referred to by the given index is hidden in the view, otherwise returns false. The way items are hidden depends on the view. For example TableView allows hiding columns and TreeView allows rows.

Implements QAbstractItemView::isIndexHidden()

bool QHeaderView::isSectionHidden ( int  logicalIndex) const

Returns true if the section specified by logicalIndex is explicitly hidden from the user, otherwise returns false.

See also
hideSection(), showSection(), setSectionHidden(), hiddenSectionCount()
bool QHeaderView::isSortIndicatorShown ( ) const

Returns true if the isSortIndicatorShown property is set, otherwise returns false.

int QHeaderView::length ( ) const

Returns the length along the orientation of the header.

See also
sizeHint(), setSectionResizeMode(), offset()
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(). The value for visualIndex is not affected by hidden sections.

See also
visualIndex(), sectionPosition()
int QHeaderView::logicalIndexAt ( const QPoint pos) const
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.

See also
sectionPosition()
int QHeaderView::logicalIndexAt ( int  position) const

Returns the section that covers the given position in the viewport.

See also
visualIndexAt(), isSectionHidden()
int QHeaderView::logicalIndexAt ( int  x,
int  y 
) const
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.

int QHeaderView::maximumSectionSize ( ) const

Returns the current value of the maximumSectionSize property.

int QHeaderView::minimumSectionSize ( ) const

Returns the current value of the minimumSectionSize property.

void QHeaderView::mouseDoubleClickEvent ( QMouseEvent event)
overrideprotectedvirtual
void QHeaderView::mouseMoveEvent ( QMouseEvent event)
overrideprotectedvirtual
void QHeaderView::mousePressEvent ( QMouseEvent event)
overrideprotectedvirtual
void QHeaderView::mouseReleaseEvent ( QMouseEvent event)
overrideprotectedvirtual
QModelIndex QHeaderView::moveCursor ( CursorAction  cursorAction,
Qt::KeyboardModifiers  modifiers 
)
overrideprotectedvirtual

Returns a QModelIndex object pointing to the next object in the view, based on the given cursorAction and keyboard modifiers specified by modifiers.

Implements QAbstractItemView::moveCursor()

void QHeaderView::moveSection ( int  from,
int  to 
)

Moves the section at visual index from to occupy visual index to.

See also
sectionsMoved()
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.

See also
setOffset()
Qt::Orientation QHeaderView::orientation ( ) const

Returns the orientation of the header.

See also
Qt::Orientation
void QHeaderView::paintEvent ( QPaintEvent event)
overrideprotectedvirtual

Reimplemented from QWidget::paintEvent()

void QHeaderView::paintSection ( QPainter painter,
const QRect rect,
int  logicalIndex 
) const
protectedvirtual

Paints the section specified by the given logicalIndex, using the given painter and rect.

Normally, you do not have to call this function.

void QHeaderView::reset ( )
override

Reimplemented from QAbstractItemView::reset()

void QHeaderView::resetDefaultSectionSize ( )

Resets the value of the defaultSectionSize property.

int QHeaderView::resizeContentsPrecision ( ) const

Returns the precision QHeaderView will use to calculate a size for a ResizeToContents event.

See also
setResizeContentsPrecision(), setSectionResizeMode()
void QHeaderView::resizeSection ( int  logicalIndex,
int  size 
)

Resizes the section specified by logicalIndex to size measured in pixels.

See also
sectionResized(), sectionSize()
void QHeaderView::resizeSections ( )
protectedslot

Resizes the sections according to their size hints. Normally you do not have to call this method.

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

Resizes the sections according to the given mode, ignoring the current resize mode.

See also
sectionResized()
bool QHeaderView::restoreState ( const QByteArray state)

Restores the state of this header view. This function returns true if the state was restored, otherwise returns false.

See also
saveState()
QByteArray QHeaderView::saveState ( ) const

Saves the current state of this header view. To restore the saved state, pass the return value to restoreState().

See also
restoreState()
void QHeaderView::scrollContentsBy ( int  dx,
int  dy 
)
overrideprotectedvirtual

This virtual handler is called when the scroll bars are moved by dx, dy, and consequently the viewport's contents should be scrolled accordingly.

The default implementation simply calls update() on the entire viewport(). Subclasses can reimplement this handler for optimization purposes, or as with QScrollArea to move a contents widget. The parameters dx and dy are there for convenience, so that the class knows how much should be scrolled. You may ignore these values and scroll directly to the position the scroll bars indicate.

Calling this method in order to scroll programmatically is an error, use the scroll bars instead (e.g. by calling QScrollBar::setValue() directly).

Reimplemented from QAbstractScrollArea::scrollContentsBy()

void QHeaderView::scrollTo ( const QModelIndex index,
ScrollHint  hint 
)
overrideprotectedvirtual

Scrolls the view if necessary to ensure that the item at index is visible. The view will try to position the item according to the given hint.

Implements QAbstractItemView::scrollTo()

void QHeaderView::sectionClicked ( int  logicalIndex)
signal

This signal is emitted when a section is clicked. The section's logical index is specified by logicalIndex. The sectionPressed signal will also be emitted.

See also
setSectionsClickable(), sectionPressed()
void QHeaderView::sectionCountChanged ( int  oldCount,
int  newCount 
)
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.

See also
count(), length(), headerDataChanged()
void QHeaderView::sectionDoubleClicked ( int  logicalIndex)
signal

This signal is emitted when a section is double-clicked. The section's logical index is specified by logicalIndex.

See also
setSectionsClickable()
void QHeaderView::sectionEntered ( int  logicalIndex)
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.

See also
setSectionsClickable(), sectionPressed()
void QHeaderView::sectionHandleDoubleClicked ( int  logicalIndex)
signal

This signal is emitted when a section is double-clicked. The section's logical index is specified by logicalIndex.

See also
setSectionsClickable()
void QHeaderView::sectionMoved ( int  logicalIndex,
int  oldVisualIndex,
int  newVisualIndex 
)
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.

See also
moveSection()
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.

See also
sectionViewportPosition()
void QHeaderView::sectionPressed ( int  logicalIndex)
signal

This signal is emitted when a section is pressed. The section's logical index is specified by logicalIndex.

See also
setSectionsClickable()
void QHeaderView::sectionResized ( int  logicalIndex,
int  oldSize,
int  newSize 
)
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.

See also
resizeSection()
QHeaderView::ResizeMode QHeaderView::sectionResizeMode ( int  logicalIndex) const

Returns the resize mode that applies to the section specified by the given logicalIndex.

See also
setSectionResizeMode()
void QHeaderView::sectionsAboutToBeRemoved ( const QModelIndex parent,
int  logicalFirst,
int  logicalLast 
)
protectedslot

This slot is called when sections are removed from the parent. The values for logicalFirst and logicalLast signify where the sections were removed.

If only one section is removed logicalFirst and logicalLast will be the same.

bool QHeaderView::sectionsClickable ( ) const

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
setSectionsClickable()
bool QHeaderView::sectionsHidden ( ) const

Returns true if sections in the header have been hidden, otherwise returns false.

See also
setSectionHidden()
void QHeaderView::sectionsInserted ( const QModelIndex parent,
int  logicalFirst,
int  logicalLast 
)
protectedslot

This slot is called when sections are inserted into the parent. The logicalFirst and logicalLast indices signify where the new sections were inserted. If only one section is inserted logicalFirst and logicalLast will be the same.

int QHeaderView::sectionSize ( int  logicalIndex) const

Returns the width (or height for vertical headers) of the given logicalIndex

See also
length(), setSectionResizeMode(), defaultSectionSize()
QSize QHeaderView::sectionSizeFromContents ( int  logicalIndex) const
protectedvirtual

Returns the size of the contents of the section specified by the given logicalIndex.

See also
defaultSectionSize()
int QHeaderView::sectionSizeHint ( int  logicalIndex) const

Returns a suitable size hint for the section specified by logicalIndex.

See also
sizeHint(), defaultSectionSize(), minimumSectionSize(), Qt::ItemDataRole
bool QHeaderView::sectionsMovable ( ) const

Returns true if the header can be moved by the user, otherwise returns false.

See also
setSectionsMovable()
bool QHeaderView::sectionsMoved ( ) const

Returns true if sections in the header have been moved, otherwise returns false.

See also
moveSection()
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.

See also
sectionPosition(), isSectionHidden()
void QHeaderView::setCascadingSectionResizes ( bool  enable)

Sets the cascadingSectionResizes property to enable.

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

Sets the defaultAlignment property to alignment.

void QHeaderView::setDefaultSectionSize ( int  size)

Sets the defaultSectionSize property to size.

void QHeaderView::setHighlightSections ( bool  highlight)

Sets the highlightSections property to highlight.

void QHeaderView::setMaximumSectionSize ( int  size)

Sets the maximumSectionSize property to size.

void QHeaderView::setMinimumSectionSize ( int  size)

Sets the minimumSectionSize property to size.

void QHeaderView::setModel ( QAbstractItemModel model)
overridevirtual

Reimplemented from QAbstractItemView::setModel()

void QHeaderView::setOffset ( int  offset)
slot

Sets the header's offset to offset.

See also
offset(), length()
void QHeaderView::setOffsetToLastSection ( )
slot

Sets the offset to make the last section visible.

See also
setOffset(), sectionPosition(), setOffsetToSectionPosition()
void QHeaderView::setOffsetToSectionPosition ( int  visualIndex)
slot

Sets the offset to the start of the section at the given visualIndex.

See also
setOffset(), sectionPosition()
void QHeaderView::setResizeContentsPrecision ( int  precision)

Sets how precise QHeaderView should calculate the size when ResizeToContents is used. A low value will provide a less accurate but fast auto resize while a higher value will provide a more accurate resize that however can be slow.

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.

See also
resizeContentsPrecision(), setSectionResizeMode(), resizeSections(), QTableView::sizeHintForColumn(), QTableView::sizeHintForRow(), QTreeView::sizeHintForColumn()
void QHeaderView::setSectionHidden ( int  logicalIndex,
bool  hide 
)

If hide is true the section specified by logicalIndex is hidden, otherwise the section is shown.

See also
isSectionHidden(), hiddenSectionCount()
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.

Note
This setting will be ignored for the last section if the stretchLastSection property is set to true. This is the default for the horizontal headers provided by QTreeView.
See also
setStretchLastSection(), resizeContentsPrecision()
void QHeaderView::setSectionResizeMode ( ResizeMode  mode)

Sets the constraints on how the header can be resized to those described by the given mode.

See also
length(), sectionResized(), sectionResizeMode()
void QHeaderView::setSectionsClickable ( bool  clickable)

If clickable is true the header will respond to single clicks.

See also
sectionsClickable(), sectionClicked(), sectionPressed(), showSortIndicator
void QHeaderView::setSectionsMovable ( bool  movable)

If movable is true the header may be moved by the user, otherwise it is fixed in place.

See also
sectionsMovable(), sectionMoved()
void QHeaderView::setSelection ( const QRect rect,
QItemSelectionModel::SelectionFlags  flags 
)
overrideprotectedvirtual

Selects the items in the given rect according to the specified flags.

The base class implementation does nothing.

Implements QAbstractItemView::setSelection()

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. The logicalIndex may be -1 in which case no sort indicator will be shown and the model will return to its natural, unsorted order. Not all models support this operation.

See also
sortIndicatorSection(), sortIndicatorOrder()
void QHeaderView::setSortIndicatorShown ( bool  show)

Sets the sortIndicatorShown property to show.

void QHeaderView::setStretchLastSection ( bool  stretch)

Sets the value of the stretchLastSection property using stretch.

See also
stretchLastSection
void QHeaderView::setVisible ( bool  visible)
override

Sets the value of the property to visible.

void QHeaderView::showSection ( int  logicalIndex)
inline
QSize QHeaderView::sizeHint ( ) const
overridevirtual

Returns a suitable size hint for this header.

See also
sectionSizeHint()

Reimplemented from QWidget::sizeHint()

void QHeaderView::sortIndicatorChanged ( int  logicalIndex,
Qt::SortOrder  order 
)
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.

See also
setSortIndicator()
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.

See also
setSortIndicator(), sortIndicatorSection()
int QHeaderView::sortIndicatorSection ( ) const

Returns the logical index of the section that has a sort indicator. By default this is section 0.

See also
setSortIndicator(), sortIndicatorOrder(), showSortIndicator()
bool QHeaderView::stretchLastSection ( ) const

Returns true if the stretchLastSection property is set, otherwise returns false.

See also
stretchLastSection
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.

See also
stretchLastSection
void QHeaderView::swapSections ( int  first,
int  second 
)

Swaps the section at visual index first with the section at visual index second.

See also
moveSection()
int QHeaderView::verticalOffset ( ) const
overrideprotectedvirtual

Returns the vertical offset of the header. This is 0 for horizontal headers.

See also
offset()

Implements QAbstractItemView::verticalOffset()

bool QHeaderView::viewportEvent ( QEvent event)
overrideprotectedvirtual
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.

See also
logicalIndex()
int QHeaderView::visualIndexAt ( int  position) const

Returns the visual index of the section that covers the given position in the viewport.

See also
logicalIndexAt()
QRect QHeaderView::visualRect ( const QModelIndex index) const
overrideprotectedvirtual

Returns the rectangle on the viewport occupied by the item at index.

If your item is displayed in several areas then this method should return the primary area which contains index and not the complete area that index might encompasses, touch or cause drawing.

See also
indexAt(), visualRegionForSelection()

Implements QAbstractItemView::visualRect()

QRegion QHeaderView::visualRegionForSelection ( const QItemSelection selection) const
overrideprotectedvirtual

Returns the region from the viewport of the items in the given selection.

See also
visualRect(), selectedIndexes()

Implements QAbstractItemView::visualRegionForSelection()

Property Documentation

QHeaderView::cascadingSectionResizes

This property holds 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 Interactive as their resize mode.

The default value is false.

See also
cascadingSectionResizes(), setCascadingSectionResizes()
PropertiesClass Methods
read cascadingSectionResizes
write setCascadingSectionResizes
QHeaderView::defaultAlignment

This property holds the default alignment of the text in each header section.

See also
defaultAlignment(), setDefaultAlignment()
PropertiesClass Methods
read defaultAlignment
write setDefaultAlignment
QHeaderView::defaultSectionSize

This property holds the default size of the header sections before resizing. This property only affects sections that have Interactive or 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.

See also
defaultSectionSize(), setDefaultSectionSize(), resetDefaultSectionSize(), minimumSectionSize
PropertiesClass Methods
read defaultSectionSize
write setDefaultSectionSize
reset resetDefaultSectionSize
QHeaderView::highlightSections

This property holds whether the sections containing selected items are highlighted. By default, this property is false.

See also
highlightSections(), setHighlightSections()
PropertiesClass Methods
read highlightSections
write setHighlightSections
QHeaderView::maximumSectionSize

This property holds 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 possible section size.

With the exception of stretch this property is honored by all resize modes.

See also
maximumSectionSize(), setMaximumSectionSize(), defaultSectionSize
PropertiesClass Methods
read maximumSectionSize
write setMaximumSectionSize
QHeaderView::minimumSectionSize

This property holds 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 maximum of the global strut or the font metrics size.

This property is honored by all resize modes.

See also
minimumSectionSize(), setMinimumSectionSize(), defaultSectionSize
PropertiesClass Methods
read minimumSectionSize
write setMinimumSectionSize
QHeaderView::showSortIndicator

This property holds whether the sort indicator is shown. By default this property is false.

See also
isSortIndicatorShown(), setSortIndicatorShown()
PropertiesClass Methods
read isSortIndicatorShown
write setSortIndicatorShown
QHeaderView::stretchLastSection

This property holds whether the last visible section in the header takes up all the available space.

The default value is false.

Note
The horizontal headers provided by QTreeView are configured with this property set to true, ensuring that the view does not waste any of the space assigned to it for its header. If this value is set to true, this property will override the resize mode set on the last section in the header.
See also
stretchLastSection(), setStretchLastSection()
PropertiesClass Methods
read stretchLastSection
write setStretchLastSection