Qt Jambi Home

com.trolltech.qt.gui
Class QHeaderView

java.lang.Object
  extended by com.trolltech.qt.QSignalEmitter
      extended by com.trolltech.qt.QtJambiObject
          extended by com.trolltech.qt.core.QObject
              extended by com.trolltech.qt.gui.QWidget
                  extended by com.trolltech.qt.gui.QFrame
                      extended by com.trolltech.qt.gui.QAbstractScrollArea
                          extended by com.trolltech.qt.gui.QAbstractItemView
                              extended by com.trolltech.qt.gui.QHeaderView
All Implemented Interfaces:
QPaintDeviceInterface, QtJambiInterface

public class QHeaderView
extends QAbstractItemView

The QHeaderView class provides a header row or header column for item views.

A QHeaderView displays the headers used in item views such as the QTableView and QTreeView classes. It takes the place of the QHeader class previously used for the same purpose, but uses the Qt's model/view architecture for consistency with the item view classes.

The QHeaderView class is one of the Model/View Classes and is part of Qt's 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.

Moving Header Sections

A header can be fixed in place, or made movable with setMovable. It can be made clickable with setClickable, and has resizing behavior in accordance with setResizeMode.

A header emits sectionMoved if the user moves a section, sectionResized if the user resizes a section, and sectionClicked and sectionHandleDoubleClicked in response to mouse clicks. A header also emits sectionCountChanged and sectionAutoResize.

You can identify a section 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.

Appearance

QTableWidget and QTableView create default headers. If you want the headers to be visible, you can use setVisible().

Note: Each header renders the data for each section itself, and does not rely on a delegate. As a result, calling a header's setItemDelegate function will have no effect.

See Also:
Model/View Programming, QListView, QTableView, QTreeView

Nested Class Summary
static class QHeaderView.ResizeMode
          The resize mode specifies the behavior of the header sections.
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QAbstractItemView
QAbstractItemView.CursorAction, QAbstractItemView.DragDropMode, QAbstractItemView.DropIndicatorPosition, QAbstractItemView.EditTrigger, QAbstractItemView.EditTriggers, QAbstractItemView.ScrollHint, QAbstractItemView.ScrollMode, QAbstractItemView.SelectionBehavior, QAbstractItemView.SelectionMode, QAbstractItemView.State
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QFrame
QFrame.Shadow, QFrame.Shape, QFrame.StyleMask
 
Nested classes/interfaces inherited from class com.trolltech.qt.gui.QWidget
QWidget.RenderFlag, QWidget.RenderFlags
 
Nested classes/interfaces inherited from class com.trolltech.qt.QSignalEmitter
QSignalEmitter.AbstractSignal, QSignalEmitter.Signal0, QSignalEmitter.Signal1<A>, QSignalEmitter.Signal2<A,B>, QSignalEmitter.Signal3<A,B,C>, QSignalEmitter.Signal4<A,B,C,D>, QSignalEmitter.Signal5<A,B,C,D,E>, QSignalEmitter.Signal6<A,B,C,D,E,F>, QSignalEmitter.Signal7<A,B,C,D,E,F,G>, QSignalEmitter.Signal8<A,B,C,D,E,F,G,H>, QSignalEmitter.Signal9<A,B,C,D,E,F,G,H,I>
 
Field Summary
 QSignalEmitter.Signal0 geometriesChanged
          This signal is emitted when the header geometries has changed.
 QSignalEmitter.Signal2<java.lang.Integer,QHeaderView.ResizeMode> sectionAutoResize
          This signal is emitted when a section is automatically resized.
 QSignalEmitter.Signal1<java.lang.Integer> sectionClicked
          This signal is emitted when a section is clicked.
 QSignalEmitter.Signal2<java.lang.Integer,java.lang.Integer> sectionCountChanged
          This signal is emitted when the number of sections changes; i.e. when sections are added or deleted.
 QSignalEmitter.Signal1<java.lang.Integer> sectionDoubleClicked
          This signal is emitted when a section is double-clicked.
 QSignalEmitter.Signal1<java.lang.Integer> sectionEntered
          This signal is emitted when the cursor moves over the section and the left mouse button is pressed.
 QSignalEmitter.Signal1<java.lang.Integer> sectionHandleDoubleClicked
          This signal is emitted when a section is double-clicked.
 QSignalEmitter.Signal3<java.lang.Integer,java.lang.Integer,java.lang.Integer> sectionMoved
          This signal is emitted when a section is moved.
 QSignalEmitter.Signal1<java.lang.Integer> sectionPressed
          This signal is emitted when a section is pressed.
 QSignalEmitter.Signal3<java.lang.Integer,java.lang.Integer,java.lang.Integer> sectionResized
          This signal is emitted when a section is resized.
 QSignalEmitter.Signal2<java.lang.Integer,Qt.SortOrder> sortIndicatorChanged
          This signal is emitted when the section containing the sort indicator or the order indicated is changed.
 
Fields inherited from class com.trolltech.qt.gui.QAbstractItemView
activated, clicked, doubleClicked, entered, pressed, viewportEntered
 
Fields inherited from class com.trolltech.qt.gui.QWidget
customContextMenuRequested
 
Constructor Summary
QHeaderView(Qt.Orientation orientation)
          Equivalent to QHeaderView(orientation, 0).
QHeaderView(Qt.Orientation orientation, QWidget parent)
          Creates a new generic header with the given orientation and parent.
 
Method Summary
 boolean cascadingSectionResizes()
          Returns whether interactive resizing will be cascaded to the following sections once the section being resized by the user has reached its minimum size.
 int count()
          Returns the number of sections in the header.
protected  void currentChanged(QModelIndex current, QModelIndex old)
          This function is reimplemented for internal reasons.
protected  void dataChanged(QModelIndex topLeft, QModelIndex bottomRight)
          This function is reimplemented for internal reasons.
 Qt.Alignment defaultAlignment()
          Returns the default alignment of the text in each header section.
 int defaultSectionSize()
          Returns the default size of the header sections before resizing..
 void doItemsLayout()
          This function is reimplemented for internal reasons.
 boolean event(QEvent e)
          This function is reimplemented for internal reasons.
static QHeaderView fromNativePointer(QNativePointer nativePointer)
          This function returns the QHeaderView instance pointed to by nativePointer
 void headerDataChanged(Qt.Orientation orientation, int logicalFirst, int logicalLast)
          Updates the changed header sections with the given orientation, from logicalFirst to logicalLast inclusive.
 int hiddenSectionCount()
          Returns the number of sections in the header that has been hidden.
 void hideSection(int logicalIndex)
          Hides the section specified by logicalIndex.
 boolean highlightSections()
          Returns whether the sections containing selected items are highlighted.
protected  int horizontalOffset()
          Returns the horizontal offset of the header.
 QModelIndex indexAt(QPoint p)
          This function is reimplemented for internal reasons.
protected  void initialize()
          
protected  void initializeSections()
          
protected  void initializeSections(int start, int end)
          
protected  void initStyleOption(QStyleOptionHeader option)
          Initialize option with the values from this QHeaderView.
 boolean isClickable()
          Returns true if the header is clickable; otherwise returns false.
protected  boolean isIndexHidden(QModelIndex index)
          This function is reimplemented for internal reasons.
 boolean isMovable()
          Returns true if the header can be moved by the user; otherwise returns false.
 boolean isSectionHidden(int logicalIndex)
          Returns true if the section specified by logicalIndex is explicitly hidden from the user; otherwise returns false.
 boolean isSortIndicatorShown()
          Returns whether the sort indicator is shown.
 int length()
          Returns the length along the orientation of the header.
 int logicalIndex(int visualIndex)
          Returns the logicalIndex for the section at the given visualIndex position, or -1 otherwise.
 int logicalIndexAt(int position)
          Returns the section that covers the given position in the viewport.
 int logicalIndexAt(int x, int y)
          Returns the logical index of the section at the given coordinate.
 int logicalIndexAt(QPoint pos)
          Returns the logical index of the section at the position given in pos.
 int minimumSectionSize()
          Returns the minimum size of the header sections..
protected  void mouseDoubleClickEvent(QMouseEvent e)
          This function is reimplemented for internal reasons.
protected  void mouseMoveEvent(QMouseEvent e)
          This function is reimplemented for internal reasons.
protected  void mousePressEvent(QMouseEvent e)
          This function is reimplemented for internal reasons.
protected  void mouseReleaseEvent(QMouseEvent e)
          This function is reimplemented for internal reasons.
protected  QModelIndex moveCursor(QAbstractItemView.CursorAction arg__1, Qt.KeyboardModifiers arg__2)
          Moves the cursor in the view according to the given arg__1 and keyboard modifiers specified by arg__2.
 void moveSection(int from, int to)
          Moves the section at visual index from to occupy visual index to.
 int offset()
          Returns the offset of the header: this is the header's left-most (or top-most for vertical headers) visible pixel.
 Qt.Orientation orientation()
          Returns the orientation of the header.
protected  void paintEvent(QPaintEvent e)
          This function is reimplemented for internal reasons.
protected  void paintSection(QPainter painter, QRect rect, int logicalIndex)
          Paints the section specified by the given logicalIndex, using the given painter and rect.
 void reset()
          This function is reimplemented for internal reasons.
 QHeaderView.ResizeMode resizeMode(int logicalIndex)
          Returns the resize mode that applies to the section specified by the given logicalIndex.
 void resizeSection(int logicalIndex, int size)
          Resizes the section specified by logicalIndex to the size measured in pixels.
protected  void resizeSections()
          Resizes the sections according to their size hints.
 void resizeSections(QHeaderView.ResizeMode mode)
          Resizes the sections according to the given mode, ignoring the current resize mode.
 boolean restoreState(QByteArray state)
          Restores the state of this header view.
protected  void rowsInserted(QModelIndex parent, int start, int end)
          This function is reimplemented for internal reasons.
 QByteArray saveState()
          Saves the current state of this header view.
protected  void scrollContentsBy(int dx, int dy)
          This function is reimplemented for internal reasons.
 void scrollTo(QModelIndex index, QAbstractItemView.ScrollHint hint)
          Scrolls the view if necessary to ensure that the item at index is visible.
 int sectionPosition(int logicalIndex)
          Returns the section position of the given logicalIndex, or -1 if the section is hidden.
protected  void sectionsAboutToBeRemoved(QModelIndex parent, int logicalFirst, int logicalLast)
          This slot is called when sections are removed from the parent, logicalFirst and logicalLast signify where the sections are removed from.
 boolean sectionsHidden()
          Returns true if sections in the header has been hidden; otherwise returns false;
protected  void sectionsInserted(QModelIndex parent, int logicalFirst, int logicalLast)
          This slot is called when sections are inserted into the parent, logicalFirst and logicalLast indexes signify where the new sections are inserted.
 int sectionSize(int logicalIndex)
          Returns the width (or height for vertical headers) of the given logicalIndex.
protected  QSize sectionSizeFromContents(int logicalIndex)
          Returns the size of the contents of the section specified by the give logicalIndex.
 int sectionSizeHint(int logicalIndex)
          Returns a suitable size hint for the section specified by logicalIndex.
 boolean sectionsMoved()
          Returns true if sections in the header has been moved; otherwise returns false;
 int sectionViewportPosition(int logicalIndex)
          Returns the section viewport position of the given logicalIndex.
 void setCascadingSectionResizes(boolean enable)
          Sets whether interactive resizing will be cascaded to the following sections once the section being resized by the user has reached its minimum size to enable.
 void setClickable(boolean clickable)
          If clickable is true, the header will respond to single clicks.
 void setDefaultAlignment(Qt.Alignment alignment)
          Sets the default alignment of the text in each header section to alignment.
 void setDefaultAlignment(Qt.AlignmentFlag... alignment)
          Sets the default alignment of the text in each header section to alignment.
 void setDefaultSectionSize(int size)
          Sets the default size of the header sections before resizing. to size.
 void setHighlightSections(boolean highlight)
          Sets whether the sections containing selected items are highlighted to highlight.
 void setMinimumSectionSize(int size)
          Sets the minimum size of the header sections. to size.
 void setModel(QAbstractItemModel model)
          This function is reimplemented for internal reasons.
 void setMovable(boolean movable)
          If movable is true, the header may be moved by the user; otherwise it is fixed in place.
 void setOffset(int offset)
          Sets the header's offset to offset.
 void setOffsetToLastSection()
          Sets the offset to make the last section visible.
 void setOffsetToSectionPosition(int visualIndex)
          Sets the offset to the start of the section at the given visualIndex.
 void setResizeMode(int logicalIndex, QHeaderView.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.
 void setResizeMode(QHeaderView.ResizeMode mode)
          Sets the constraints on how the header can be resized to those described by the given mode.
 void setSectionHidden(int logicalIndex, boolean hide)
          If hide is true the section specified by logicalIndex is hidden, otherwise the section is shown.
protected  void setSelection(QRect arg__1, QItemSelectionModel.SelectionFlags arg__2)
          Applies the selection arg__2 to the items in or touched by the rectangle, arg__1.
 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.
 void setSortIndicatorShown(boolean show)
          Sets whether the sort indicator is shown to show.
 void setStretchLastSection(boolean stretch)
          Sets whether the last visible section in the header takes up all the available space to stretch.
 void showSection(int logicalIndex)
          Shows the section specified by logicalIndex.
 QSize sizeHint()
          Returns a suitable size hint for this header.
 Qt.SortOrder sortIndicatorOrder()
          Returns the order for the sort indicator.
 int sortIndicatorSection()
          Returns the logical index of the section that has a sort indicator.
 boolean stretchLastSection()
          Returns whether the last visible section in the header takes up all the available space.
 int stretchSectionCount()
          Returns the number of sections that are set to resize mode stretch.
 void swapSections(int first, int second)
          Swaps the section at visual index first with the section at visual index second.
protected  void updateGeometries()
          This function is reimplemented for internal reasons.
protected  void updateSection(int logicalIndex)
          
protected  int verticalOffset()
          Returns the vertical offset of the header.
protected  boolean viewportEvent(QEvent e)
          This function is reimplemented for internal reasons.
 int visualIndex(int logicalIndex)
          Returns the visual index position of the section specified by the given logicalIndex, or -1 otherwise.
 int visualIndexAt(int position)
          Returns the visual index of the section that covers the given position in the viewport.
 QRect visualRect(QModelIndex index)
          This function is reimplemented for internal reasons.
protected  QRegion visualRegionForSelection(QItemSelection selection)
          This function is reimplemented for internal reasons.
 
Methods inherited from class com.trolltech.qt.gui.QAbstractItemView
alternatingRowColors, clearSelection, closeEditor, closePersistentEditor, commitData, currentIndex, dirtyRegionOffset, doAutoScroll, dragDropMode, dragDropOverwriteMode, dragEnabled, dragEnterEvent, dragLeaveEvent, dragMoveEvent, dropEvent, dropIndicatorPosition, edit, edit, editorDestroyed, editTriggers, executeDelayedItemsLayout, focusInEvent, focusNextPrevChild, focusOutEvent, hasAutoScroll, horizontalScrollbarAction, horizontalScrollbarValueChanged, horizontalScrollMode, iconSize, indexWidget, inputMethodEvent, inputMethodQuery, itemDelegate, itemDelegate, itemDelegateForColumn, itemDelegateForRow, keyboardSearch, keyPressEvent, model, openPersistentEditor, resizeEvent, rootIndex, rowsAboutToBeRemoved, scheduleDelayedItemsLayout, scrollDirtyRegion, scrollTo, scrollToBottom, scrollToTop, selectAll, selectedIndexes, selectionBehavior, selectionChanged, selectionCommand, selectionCommand, selectionMode, selectionModel, setAlternatingRowColors, setAutoScroll, setCurrentIndex, setDirtyRegion, setDragDropMode, setDragDropOverwriteMode, setDragEnabled, setDropIndicatorShown, setEditTriggers, setEditTriggers, setHorizontalScrollMode, setIconSize, setIndexWidget, setItemDelegate, setItemDelegateForColumn, setItemDelegateForRow, setRootIndex, setSelectionBehavior, setSelectionMode, setSelectionModel, setState, setTabKeyNavigation, setTextElideMode, setVerticalScrollMode, showDropIndicator, sizeHintForColumn, sizeHintForIndex, sizeHintForRow, startAutoScroll, startDrag, startDrag, state, stopAutoScroll, tabKeyNavigation, textElideMode, timerEvent, update, updateEditorData, updateEditorGeometries, verticalScrollbarAction, verticalScrollbarValueChanged, verticalScrollMode, viewOptions
 
Methods inherited from class com.trolltech.qt.gui.QAbstractScrollArea
addScrollBarWidget, addScrollBarWidget, contextMenuEvent, cornerWidget, horizontalScrollBar, horizontalScrollBarPolicy, maximumViewportSize, minimumSizeHint, paintEngine, scrollBarWidgets, scrollBarWidgets, setCornerWidget, setHorizontalScrollBar, setHorizontalScrollBarPolicy, setupViewport, setVerticalScrollBar, setVerticalScrollBarPolicy, setViewport, setViewportMargins, verticalScrollBar, verticalScrollBarPolicy, viewport, wheelEvent
 
Methods inherited from class com.trolltech.qt.gui.QFrame
changeEvent, drawFrame, frameRect, frameShadow, frameShape, frameStyle, frameWidth, lineWidth, midLineWidth, setFrameRect, setFrameShadow, setFrameShape, setFrameStyle, setLineWidth, setMidLineWidth
 
Methods inherited from class com.trolltech.qt.gui.QWidget
acceptDrops, accessibleDescription, accessibleName, actionEvent, actions, activateWindow, addAction, addActions, adjustSize, autoFillBackground, backgroundRole, baseSize, childAt, childAt, childrenRect, childrenRegion, clearFocus, clearMask, close, closeEvent, contentsRect, contextMenuPolicy, createWinId, cursor, depth, destroy, destroy, destroy, devType, ensurePolished, enterEvent, focusNextChild, focusPolicy, focusPreviousChild, focusProxy, focusWidget, font, fontInfo, fontMetrics, foregroundRole, frameGeometry, frameSize, geometry, getContentsMargins, grabKeyboard, grabMouse, grabMouse, grabShortcut, grabShortcut, hasFocus, hasMouseTracking, height, heightForWidth, heightMM, hide, hideEvent, inputContext, insertAction, insertActions, isActiveWindow, isAncestorOf, isEnabled, isEnabledTo, isFullScreen, isHidden, isLeftToRight, isMaximized, isMinimized, isModal, isRightToLeft, isVisible, isVisibleTo, isWindow, isWindowModified, keyboardGrabber, keyReleaseEvent, layout, layoutDirection, leaveEvent, locale, logicalDpiX, logicalDpiY, lower, mapFrom, mapFromGlobal, mapFromParent, mapTo, mapToGlobal, mapToParent, mask, maximumHeight, maximumSize, maximumWidth, metric, minimumHeight, minimumSize, minimumWidth, mouseGrabber, move, move, moveEvent, nextInFocusChain, normalGeometry, numColors, overrideWindowFlags, overrideWindowFlags, overrideWindowState, overrideWindowState, paintingActive, palette, parentWidget, physicalDpiX, physicalDpiY, pos, raise, rect, releaseKeyboard, releaseMouse, releaseShortcut, removeAction, render, render, render, render, render, repaint, repaint, repaint, repaint, resetInputContext, resize, resize, restoreGeometry, saveGeometry, scroll, scroll, setAcceptDrops, setAccessibleDescription, setAccessibleName, setAttribute, setAttribute, setAutoFillBackground, setBackgroundRole, setBaseSize, setBaseSize, setContentsMargins, setContentsMargins, setContextMenuPolicy, setCursor, setDisabled, setEnabled, setFixedHeight, setFixedSize, setFixedSize, setFixedWidth, setFocus, setFocus, setFocusPolicy, setFocusProxy, setFont, setForegroundRole, setGeometry, setGeometry, setHidden, setInputContext, setLayout, setLayoutDirection, setLocale, setMask, setMask, setMaximumHeight, setMaximumSize, setMaximumSize, setMaximumWidth, setMinimumHeight, setMinimumSize, setMinimumSize, setMinimumWidth, setMouseTracking, setPalette, setParent, setParent, setParent, setShortcutAutoRepeat, setShortcutAutoRepeat, setShortcutEnabled, setShortcutEnabled, setSizeIncrement, setSizeIncrement, setSizePolicy, setSizePolicy, setStatusTip, setStyle, setStyleSheet, setTabOrder, setToolTip, setUpdatesEnabled, setVisible, setWhatsThis, setWindowFlags, setWindowFlags, setWindowIcon, setWindowIconText, setWindowModality, setWindowModified, setWindowOpacity, setWindowRole, setWindowState, setWindowState, setWindowTitle, show, showEvent, showFullScreen, showMaximized, showMinimized, showNormal, size, sizeIncrement, sizePolicy, stackUnder, statusTip, style, styleSheet, tabletEvent, testAttribute, toolTip, underMouse, unsetCursor, unsetLayoutDirection, unsetLocale, update, update, update, update, updateGeometry, updateMicroFocus, updatesEnabled, visibleRegion, whatsThis, width, widthMM, window, windowFlags, windowIcon, windowIconText, windowModality, windowOpacity, windowRole, windowState, windowTitle, windowType, winId, x, y
 
Methods inherited from class com.trolltech.qt.core.QObject
blockSignals, childEvent, children, connectSlotsByName, customEvent, disposeLater, dumpObjectInfo, dumpObjectTree, dynamicPropertyNames, eventFilter, findChild, findChild, findChild, findChildren, findChildren, findChildren, findChildren, installEventFilter, isWidgetType, killTimer, moveToThread, objectName, parent, property, removeEventFilter, setObjectName, setParent, setProperty, signalsBlocked, startTimer, thread
 
Methods inherited from class com.trolltech.qt.QtJambiObject
dispose, disposed, finalize, reassignNativeResources, tr, tr, tr
 
Methods inherited from class com.trolltech.qt.QSignalEmitter
disconnect, disconnect, signalSender
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.trolltech.qt.QtJambiInterface
disableGarbageCollection, nativeId, nativePointer, reenableGarbageCollection, setJavaOwnership
 

Field Detail

geometriesChanged

public final QSignalEmitter.Signal0 geometriesChanged

This signal is emitted when the header geometries has changed.

Compatible Slot Signature:
void mySlot()


sectionAutoResize

public final QSignalEmitter.Signal2<java.lang.Integer,QHeaderView.ResizeMode> sectionAutoResize

This signal is emitted when a section is automatically resized. The section's logical index is specified by logicalIndex, and the resize mode by mode.

Compatible Slot Signatures:
void mySlot(int logicalIndex, com.trolltech.qt.gui.QHeaderView.ResizeMode mode)
void mySlot(int logicalIndex)
void mySlot()
See Also:
setResizeMode, stretchLastSection


sectionClicked

public final QSignalEmitter.Signal1<java.lang.Integer> sectionClicked

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.

Compatible Slot Signatures:
void mySlot(int logicalIndex)
void mySlot()
See Also:
setClickable, sectionPressed


sectionCountChanged

public final QSignalEmitter.Signal2<java.lang.Integer,java.lang.Integer> sectionCountChanged

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.

Compatible Slot Signatures:
void mySlot(int oldCount, int newCount)
void mySlot(int oldCount)
void mySlot()
See Also:
count, length, headerDataChanged


sectionDoubleClicked

public final QSignalEmitter.Signal1<java.lang.Integer> sectionDoubleClicked

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

Compatible Slot Signatures:
void mySlot(int logicalIndex)
void mySlot()
See Also:
setClickable


sectionEntered

public final QSignalEmitter.Signal1<java.lang.Integer> sectionEntered

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.

Compatible Slot Signatures:
void mySlot(int logicalIndex)
void mySlot()
See Also:
setClickable, sectionPressed


sectionHandleDoubleClicked

public final QSignalEmitter.Signal1<java.lang.Integer> sectionHandleDoubleClicked

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

Compatible Slot Signatures:
void mySlot(int logicalIndex)
void mySlot()
See Also:
setClickable


sectionMoved

public final QSignalEmitter.Signal3<java.lang.Integer,java.lang.Integer,java.lang.Integer> sectionMoved

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.

Compatible Slot Signatures:
void mySlot(int logicalIndex, int oldVisualIndex, int newVisualIndex)
void mySlot(int logicalIndex, int oldVisualIndex)
void mySlot(int logicalIndex)
void mySlot()
See Also:
moveSection


sectionPressed

public final QSignalEmitter.Signal1<java.lang.Integer> sectionPressed

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

Compatible Slot Signatures:
void mySlot(int logicalIndex)
void mySlot()
See Also:
setClickable


sectionResized

public final QSignalEmitter.Signal3<java.lang.Integer,java.lang.Integer,java.lang.Integer> sectionResized

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.

Compatible Slot Signatures:
void mySlot(int logicalIndex, int oldSize, int newSize)
void mySlot(int logicalIndex, int oldSize)
void mySlot(int logicalIndex)
void mySlot()
See Also:
resizeSection


sortIndicatorChanged

public final QSignalEmitter.Signal2<java.lang.Integer,Qt.SortOrder> sortIndicatorChanged

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.

Compatible Slot Signatures:
void mySlot(int logicalIndex, com.trolltech.qt.core.Qt.SortOrder order)
void mySlot(int logicalIndex)
void mySlot()
See Also:
setSortIndicator

Constructor Detail

QHeaderView

public QHeaderView(Qt.Orientation orientation)

Equivalent to QHeaderView(orientation, 0).


QHeaderView

public QHeaderView(Qt.Orientation orientation,
                   QWidget parent)

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

Method Detail

cascadingSectionResizes

public final boolean cascadingSectionResizes()

Returns 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 the resize mode.

The default value is false.

See Also:
setCascadingSectionResizes, setResizeMode

count

public final int count()

Returns the number of sections in the header.

See Also:
sectionCountChanged, length

defaultAlignment

public final Qt.Alignment defaultAlignment()

Returns the default alignment of the text in each header section.

See Also:
setDefaultAlignment

defaultSectionSize

public final int defaultSectionSize()

Returns the default size of the header sections before resizing..

This property only affects sections that have Interactive or Fixed as the resize mode.

See Also:
setDefaultSectionSize, setResizeMode, minimumSectionSize

headerDataChanged

public final void headerDataChanged(Qt.Orientation orientation,
                                    int logicalFirst,
                                    int logicalLast)

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


hiddenSectionCount

public final int hiddenSectionCount()

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

See Also:
setSectionHidden, isSectionHidden

hideSection

public final void hideSection(int logicalIndex)

Hides the section specified by logicalIndex.

See Also:
showSection, isSectionHidden, hiddenSectionCount, setSectionHidden

highlightSections

public final boolean highlightSections()

Returns whether the sections containing selected items are highlighted.

See Also:
setHighlightSections

initialize

protected final void initialize()


initializeSections

protected final void initializeSections(int start,
                                        int end)


initializeSections

protected final void initializeSections()


isClickable

public final boolean isClickable()

Returns true if the header is clickable; otherwise returns false. A clickable header could be set up to allow the user to change the representation of the data in the view related to the header.

See Also:
setClickable

isMovable

public final boolean isMovable()

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

See Also:
setMovable

isSectionHidden

public final boolean isSectionHidden(int logicalIndex)

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

See Also:
hideSection, showSection, setSectionHidden, hiddenSectionCount

isSortIndicatorShown

public final boolean isSortIndicatorShown()

Returns whether the sort indicator is shown.

See Also:
setClickable

length

public final int length()

Returns the length along the orientation of the header.

See Also:
sizeHint, setResizeMode, offset

logicalIndex

public final int logicalIndex(int visualIndex)

Returns the logicalIndex for the section at the given visualIndex position, or -1 otherwise.

See Also:
visualIndex, sectionPosition

logicalIndexAt

public final int logicalIndexAt(int x,
                                int y)

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.


logicalIndexAt

public final int logicalIndexAt(int position)

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

See Also:
visualIndexAt, isSectionHidden

logicalIndexAt

public final int logicalIndexAt(QPoint pos)

Returns the logical index of the section at the position given in pos. If the header is horizontal the x-coordinate will be used to find the logical index; otherwise the y-coordinate will be used.

See Also:
sectionPosition

minimumSectionSize

public final int minimumSectionSize()

Returns 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:
setMinimumSectionSize, setResizeMode, defaultSectionSize

moveSection

public final void moveSection(int from,
                              int to)

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

See Also:
sectionsMoved

offset

public final int offset()

Returns the offset of the header: this is the header's left-most (or top-most for vertical headers) visible pixel.

See Also:
setOffset

orientation

public final Qt.Orientation orientation()

Returns the orientation of the header.

See Also:
Qt::Orientation

resizeMode

public final QHeaderView.ResizeMode resizeMode(int logicalIndex)

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

See Also:
setResizeMode

resizeSection

public final void resizeSection(int logicalIndex,
                                int size)

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

See Also:
sectionResized, resizeMode, sectionSize

resizeSections

public final void resizeSections(QHeaderView.ResizeMode mode)

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

See Also:
resizeMode, sectionResized

resizeSections

protected final void resizeSections()

Resizes the sections according to their size hints. You should not normally need to call this function.


restoreState

public final boolean restoreState(QByteArray state)

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

See Also:
saveState

saveState

public final QByteArray saveState()

Saves the current state of this header view.

To restore the saved state, pass the return value to restoreState.

See Also:
restoreState

sectionPosition

public final int sectionPosition(int logicalIndex)

Returns the section position of the given logicalIndex, or -1 if the section is hidden.

See Also:
sectionViewportPosition

sectionSize

public final int sectionSize(int logicalIndex)

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

See Also:
length, setResizeMode, defaultSectionSize

sectionSizeHint

public final int sectionSizeHint(int logicalIndex)

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

See Also:
sizeHint, defaultSectionSize, minimumSectionSize, Qt::SizeHintRole

sectionViewportPosition

public final int sectionViewportPosition(int logicalIndex)

Returns the section viewport position of the given logicalIndex.

If the section is hidden, this function returns an undefined value.

See Also:
sectionPosition, isSectionHidden

sectionsAboutToBeRemoved

protected final void sectionsAboutToBeRemoved(QModelIndex parent,
                                              int logicalFirst,
                                              int logicalLast)

This slot is called when sections are removed from the parent, logicalFirst and logicalLast signify where the sections are removed from. (logicalFirst and logicalLast will be the same if just one section is removed.)


sectionsHidden

public final boolean sectionsHidden()

Returns true if sections in the header has been hidden; otherwise returns false;

See Also:
setSectionHidden

sectionsInserted

protected final void sectionsInserted(QModelIndex parent,
                                      int logicalFirst,
                                      int logicalLast)

This slot is called when sections are inserted into the parent, logicalFirst and logicalLast indexes signify where the new sections are inserted.

logicalFirst and logicalLast will be the same if just one section is inserted.


sectionsMoved

public final boolean sectionsMoved()

Returns true if sections in the header has been moved; otherwise returns false;

See Also:
moveSection

setCascadingSectionResizes

public final void setCascadingSectionResizes(boolean enable)

Sets whether interactive resizing will be cascaded to the following sections once the section being resized by the user has reached its minimum size to enable.

This property only affects sections that have Interactive as the resize mode.

The default value is false.

See Also:
cascadingSectionResizes, setResizeMode

setClickable

public final void setClickable(boolean clickable)

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

See Also:
isClickable, sectionClicked, sectionPressed, setSortIndicatorShown

setDefaultAlignment

public final void setDefaultAlignment(Qt.AlignmentFlag... alignment)

Sets the default alignment of the text in each header section to alignment.

See Also:
defaultAlignment

setDefaultAlignment

public final void setDefaultAlignment(Qt.Alignment alignment)

Sets the default alignment of the text in each header section to alignment.

See Also:
defaultAlignment

setDefaultSectionSize

public final void setDefaultSectionSize(int size)

Sets the default size of the header sections before resizing. to size.

This property only affects sections that have Interactive or Fixed as the resize mode.

See Also:
defaultSectionSize, setResizeMode, minimumSectionSize

setHighlightSections

public final void setHighlightSections(boolean highlight)

Sets whether the sections containing selected items are highlighted to highlight.

See Also:
highlightSections

setMinimumSectionSize

public final void setMinimumSectionSize(int size)

Sets the minimum size of the header sections. to size.

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, setResizeMode, defaultSectionSize

setMovable

public final void setMovable(boolean movable)

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

See Also:
isMovable, sectionMoved

setOffset

public final void setOffset(int offset)

Sets the header's offset to offset.

See Also:
offset, length

setOffsetToLastSection

public final void setOffsetToLastSection()

Sets the offset to make the last section visible.

See Also:
setOffset, sectionPosition, setOffsetToSectionPosition

setOffsetToSectionPosition

public final void setOffsetToSectionPosition(int visualIndex)

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

See Also:
setOffset, sectionPosition

setResizeMode

public final void setResizeMode(QHeaderView.ResizeMode mode)

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

See Also:
resizeMode, length, sectionResized, sectionAutoResize

setResizeMode

public final void setResizeMode(int logicalIndex,
                                QHeaderView.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.

See Also:
resizeMode

setSectionHidden

public final void setSectionHidden(int logicalIndex,
                                   boolean hide)

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

See Also:
isSectionHidden, hiddenSectionCount

setSortIndicator

public final 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.

See Also:
sortIndicatorSection, sortIndicatorOrder

setSortIndicatorShown

public final void setSortIndicatorShown(boolean show)

Sets whether the sort indicator is shown to show.

See Also:
isSortIndicatorShown, setClickable

setStretchLastSection

public final void setStretchLastSection(boolean stretch)

Sets whether the last visible section in the header takes up all the available space to stretch.

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.

Also note: If the value is set to true, this property will override the resize mode set on the last section in the header.

See Also:
stretchLastSection, setResizeMode

showSection

public final void showSection(int logicalIndex)

Shows the section specified by logicalIndex.

See Also:
hideSection, isSectionHidden, hiddenSectionCount, setSectionHidden

sortIndicatorOrder

public final Qt.SortOrder sortIndicatorOrder()

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

sortIndicatorSection

public final int sortIndicatorSection()

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

See Also:
setSortIndicator, sortIndicatorOrder, setSortIndicatorShown

stretchLastSection

public final boolean stretchLastSection()

Returns 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.

Also note: If the value is set to true, this property will override the resize mode set on the last section in the header.

See Also:
setStretchLastSection, setResizeMode

stretchSectionCount

public final int stretchSectionCount()

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 geometry changes.

See Also:
stretchLastSection, resizeMode

swapSections

public final void swapSections(int first,
                               int second)

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

See Also:
moveSection

updateSection

protected final void updateSection(int logicalIndex)


visualIndex

public final int visualIndex(int logicalIndex)

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

visualIndexAt

public final int visualIndexAt(int position)

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

See Also:
logicalIndexAt

currentChanged

protected void currentChanged(QModelIndex current,
                              QModelIndex old)

This function is reimplemented for internal reasons.

Overrides:
currentChanged in class QAbstractItemView

dataChanged

protected void dataChanged(QModelIndex topLeft,
                           QModelIndex bottomRight)

This function is reimplemented for internal reasons.

Overrides:
dataChanged in class QAbstractItemView

doItemsLayout

public void doItemsLayout()

This function is reimplemented for internal reasons.

Overrides:
doItemsLayout in class QAbstractItemView

event

public boolean event(QEvent e)

This function is reimplemented for internal reasons.

Overrides:
event in class QAbstractItemView
See Also:
QEvent::type

horizontalOffset

protected int horizontalOffset()

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

Specified by:
horizontalOffset in class QAbstractItemView
See Also:
offset

indexAt

public QModelIndex indexAt(QPoint p)

This function is reimplemented for internal reasons.

Specified by:
indexAt in class QAbstractItemView
See Also:
visualRect

isIndexHidden

protected boolean isIndexHidden(QModelIndex index)

This function is reimplemented for internal reasons.

Specified by:
isIndexHidden in class QAbstractItemView

mouseDoubleClickEvent

protected void mouseDoubleClickEvent(QMouseEvent e)

This function is reimplemented for internal reasons.

Overrides:
mouseDoubleClickEvent in class QAbstractItemView
See Also:
QWidget::mouseDoubleClickEvent

mouseMoveEvent

protected void mouseMoveEvent(QMouseEvent e)

This function is reimplemented for internal reasons.

Overrides:
mouseMoveEvent in class QAbstractItemView
See Also:
QWidget::mouseMoveEvent

mousePressEvent

protected void mousePressEvent(QMouseEvent e)

This function is reimplemented for internal reasons.

Overrides:
mousePressEvent in class QAbstractItemView
See Also:
QWidget::mousePressEvent

mouseReleaseEvent

protected void mouseReleaseEvent(QMouseEvent e)

This function is reimplemented for internal reasons.

Overrides:
mouseReleaseEvent in class QAbstractItemView
See Also:
QWidget::mouseReleaseEvent

moveCursor

protected QModelIndex moveCursor(QAbstractItemView.CursorAction arg__1,
                                 Qt.KeyboardModifiers arg__2)

Moves the cursor in the view according to the given arg__1 and keyboard modifiers specified by arg__2.

In the base class this is a pure virtual function.

Specified by:
moveCursor in class QAbstractItemView

paintEvent

protected void paintEvent(QPaintEvent e)

This function is reimplemented for internal reasons.

Overrides:
paintEvent in class QAbstractScrollArea
See Also:
QWidget::paintEvent

paintSection

protected void paintSection(QPainter painter,
                            QRect rect,
                            int logicalIndex)

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

You normally would not need to use this function.


reset

public void reset()

This function is reimplemented for internal reasons.

Overrides:
reset in class QAbstractItemView

rowsInserted

protected void rowsInserted(QModelIndex parent,
                            int start,
                            int end)

This function is reimplemented for internal reasons.

Overrides:
rowsInserted in class QAbstractItemView
See Also:
rowsAboutToBeRemoved

scrollContentsBy

protected void scrollContentsBy(int dx,
                                int dy)

This function is reimplemented for internal reasons.

Overrides:
scrollContentsBy in class QAbstractScrollArea

scrollTo

public void scrollTo(QModelIndex index,
                     QAbstractItemView.ScrollHint hint)

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.

In the base class this is a pure virtual function.

Specified by:
scrollTo in class QAbstractItemView

sectionSizeFromContents

protected QSize sectionSizeFromContents(int logicalIndex)

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

See Also:
defaultSectionSize

setModel

public void setModel(QAbstractItemModel model)

This function is reimplemented for internal reasons.

Overrides:
setModel in class QAbstractItemView
See Also:
model, selectionModel, setSelectionModel

setSelection

protected void setSelection(QRect arg__1,
                            QItemSelectionModel.SelectionFlags arg__2)

Applies the selection arg__2 to the items in or touched by the rectangle, arg__1.

When implementing your own itemview setSelection should call selectionModel->select(selection, flags) where selection is either an empty QModelIndex or a QItemSelection that contains all items that are contained in arg__1.

Specified by:
setSelection in class QAbstractItemView
See Also:
selectionCommand, selectedIndexes

sizeHint

public QSize sizeHint()

Returns a suitable size hint for this header.

Overrides:
sizeHint in class QAbstractScrollArea
See Also:
sectionSizeHint

updateGeometries

protected void updateGeometries()

This function is reimplemented for internal reasons.

Overrides:
updateGeometries in class QAbstractItemView

verticalOffset

protected int verticalOffset()

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

Specified by:
verticalOffset in class QAbstractItemView
See Also:
offset

viewportEvent

protected boolean viewportEvent(QEvent e)

This function is reimplemented for internal reasons.

Overrides:
viewportEvent in class QAbstractItemView

visualRect

public QRect visualRect(QModelIndex index)

This function is reimplemented for internal reasons.

Specified by:
visualRect in class QAbstractItemView
See Also:
indexAt, visualRegionForSelection

visualRegionForSelection

protected QRegion visualRegionForSelection(QItemSelection selection)

This function is reimplemented for internal reasons.

Specified by:
visualRegionForSelection in class QAbstractItemView
See Also:
visualRect, selectedIndexes

fromNativePointer

public static QHeaderView fromNativePointer(QNativePointer nativePointer)
This function returns the QHeaderView instance pointed to by nativePointer

Parameters:
nativePointer - the QNativePointer of which object should be returned.

initStyleOption

protected final void initStyleOption(QStyleOptionHeader option)
Initialize option with the values from this QHeaderView. This method is useful for subclasses when they need a QStyleOptionButton, but don't want to fill in all the information themselves.


Qt Jambi Home