|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.trolltech.qt.QSignalEmitter
com.trolltech.qt.QtJambiObject
com.trolltech.qt.core.QObject
com.trolltech.qt.gui.QWidget
com.trolltech.qt.gui.QFrame
com.trolltech.qt.gui.QAbstractScrollArea
com.trolltech.qt.gui.QAbstractItemView
com.trolltech.qt.gui.QHeaderView
public class QHeaderView
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.
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.
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.
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. |
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. |
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.QFrame |
---|
changeEvent, drawFrame, frameRect, frameShadow, frameShape, frameStyle, frameWidth, lineWidth, midLineWidth, setFrameRect, setFrameShadow, setFrameShape, setFrameStyle, setLineWidth, setMidLineWidth |
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 |
---|
public final QSignalEmitter.Signal0 geometriesChanged
This signal is emitted when the header geometries has changed.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
Constructor Detail |
---|
public QHeaderView(Qt.Orientation orientation)
Equivalent to QHeaderView(orientation, 0).
public QHeaderView(Qt.Orientation orientation, QWidget parent)
Creates a new generic header with the given orientation and parent.
Method Detail |
---|
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.
public final int count()
Returns the number of sections in the header.
public final Qt.Alignment defaultAlignment()
Returns the default alignment of the text in each header section.
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.
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.
public final int hiddenSectionCount()
Returns the number of sections in the header that has been hidden.
public final void hideSection(int logicalIndex)
Hides the section specified by logicalIndex.
public final boolean highlightSections()
Returns whether the sections containing selected items are highlighted.
protected final void initialize()
protected final void initializeSections(int start, int end)
protected final void initializeSections()
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.
public final boolean isMovable()
Returns true if the header can be moved by the user; otherwise returns false.
public final boolean isSectionHidden(int logicalIndex)
Returns true if the section specified by logicalIndex is explicitly hidden from the user; otherwise returns false.
public final boolean isSortIndicatorShown()
Returns whether the sort indicator is shown.
public final int length()
Returns the length along the orientation of the header.
public final int logicalIndex(int visualIndex)
Returns the logicalIndex for the section at the given visualIndex position, or -1 otherwise.
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.
public final int logicalIndexAt(int position)
Returns the section that covers the given position in the viewport.
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.
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.
public final void moveSection(int from, int to)
Moves the section at visual index from to occupy visual index to.
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.
public final Qt.Orientation orientation()
Returns the orientation of the header.
Qt::Orientation
public final QHeaderView.ResizeMode resizeMode(int logicalIndex)
Returns the resize mode that applies to the section specified by the given logicalIndex.
public final void resizeSection(int logicalIndex, int size)
Resizes the section specified by logicalIndex to the size measured in pixels.
public final void resizeSections(QHeaderView.ResizeMode mode)
Resizes the sections according to the given mode, ignoring the current resize mode.
protected final void resizeSections()
Resizes the sections according to their size hints. You should not normally need to call this function.
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.
public final QByteArray saveState()
Saves the current state of this header view.
To restore the saved state, pass the return value to restoreState.
public final int sectionPosition(int logicalIndex)
Returns the section position of the given logicalIndex, or -1 if the section is hidden.
public final int sectionSize(int logicalIndex)
Returns the width (or height for vertical headers) of the given logicalIndex.
public final int sectionSizeHint(int logicalIndex)
Returns a suitable size hint for the section specified by logicalIndex.
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.
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.)
public final boolean sectionsHidden()
Returns true if sections in the header has been hidden; otherwise returns false;
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.
public final boolean sectionsMoved()
Returns true if sections in the header has been moved; otherwise returns false;
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.
public final void setClickable(boolean clickable)
If clickable is true, the header will respond to single clicks.
public final void setDefaultAlignment(Qt.AlignmentFlag... alignment)
Sets the default alignment of the text in each header section to alignment.
public final void setDefaultAlignment(Qt.Alignment alignment)
Sets the default alignment of the text in each header section to alignment.
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.
public final void setHighlightSections(boolean highlight)
Sets whether the sections containing selected items are highlighted to highlight.
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.
public final void setMovable(boolean movable)
If movable is true, the header may be moved by the user; otherwise it is fixed in place.
public final void setOffset(int offset)
Sets the header's offset to offset.
public final void setOffsetToLastSection()
Sets the offset to make the last section visible.
public final void setOffsetToSectionPosition(int visualIndex)
Sets the offset to the start of the section at the given visualIndex.
public final void setResizeMode(QHeaderView.ResizeMode mode)
Sets the constraints on how the header can be resized to those described by the given mode.
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.
public final void setSectionHidden(int logicalIndex, boolean hide)
If hide is true the section specified by logicalIndex is hidden, otherwise the section is shown.
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.
public final void setSortIndicatorShown(boolean show)
Sets whether the sort indicator is shown to show.
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.
public final void showSection(int logicalIndex)
Shows the section specified by logicalIndex.
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.
public final int sortIndicatorSection()
Returns the logical index of the section that has a sort indicator. By default this is section 0.
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.
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.
public final void swapSections(int first, int second)
Swaps the section at visual index first with the section at visual index second.
protected final void updateSection(int logicalIndex)
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.
public final int visualIndexAt(int position)
Returns the visual index of the section that covers the given position in the viewport.
protected void currentChanged(QModelIndex current, QModelIndex old)
This function is reimplemented for internal reasons.
currentChanged
in class QAbstractItemView
protected void dataChanged(QModelIndex topLeft, QModelIndex bottomRight)
This function is reimplemented for internal reasons.
dataChanged
in class QAbstractItemView
public void doItemsLayout()
This function is reimplemented for internal reasons.
doItemsLayout
in class QAbstractItemView
public boolean event(QEvent e)
This function is reimplemented for internal reasons.
event
in class QAbstractItemView
protected int horizontalOffset()
Returns the horizontal offset of the header. This is 0 for vertical headers.
horizontalOffset
in class QAbstractItemView
public QModelIndex indexAt(QPoint p)
This function is reimplemented for internal reasons.
indexAt
in class QAbstractItemView
protected boolean isIndexHidden(QModelIndex index)
This function is reimplemented for internal reasons.
isIndexHidden
in class QAbstractItemView
protected void mouseDoubleClickEvent(QMouseEvent e)
This function is reimplemented for internal reasons.
mouseDoubleClickEvent
in class QAbstractItemView
protected void mouseMoveEvent(QMouseEvent e)
This function is reimplemented for internal reasons.
mouseMoveEvent
in class QAbstractItemView
protected void mousePressEvent(QMouseEvent e)
This function is reimplemented for internal reasons.
mousePressEvent
in class QAbstractItemView
protected void mouseReleaseEvent(QMouseEvent e)
This function is reimplemented for internal reasons.
mouseReleaseEvent
in class QAbstractItemView
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.
moveCursor
in class QAbstractItemView
protected void paintEvent(QPaintEvent e)
This function is reimplemented for internal reasons.
paintEvent
in class QAbstractScrollArea
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.
public void reset()
This function is reimplemented for internal reasons.
reset
in class QAbstractItemView
protected void rowsInserted(QModelIndex parent, int start, int end)
This function is reimplemented for internal reasons.
rowsInserted
in class QAbstractItemView
protected void scrollContentsBy(int dx, int dy)
This function is reimplemented for internal reasons.
scrollContentsBy
in class QAbstractScrollArea
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.
scrollTo
in class QAbstractItemView
protected QSize sectionSizeFromContents(int logicalIndex)
Returns the size of the contents of the section specified by the give logicalIndex.
public void setModel(QAbstractItemModel model)
This function is reimplemented for internal reasons.
setModel
in class QAbstractItemView
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.
setSelection
in class QAbstractItemView
public QSize sizeHint()
Returns a suitable size hint for this header.
sizeHint
in class QAbstractScrollArea
protected void updateGeometries()
This function is reimplemented for internal reasons.
updateGeometries
in class QAbstractItemView
protected int verticalOffset()
Returns the vertical offset of the header. This is 0 for horizontal headers.
verticalOffset
in class QAbstractItemView
protected boolean viewportEvent(QEvent e)
This function is reimplemented for internal reasons.
viewportEvent
in class QAbstractItemView
public QRect visualRect(QModelIndex index)
This function is reimplemented for internal reasons.
visualRect
in class QAbstractItemView
protected QRegion visualRegionForSelection(QItemSelection selection)
This function is reimplemented for internal reasons.
visualRegionForSelection
in class QAbstractItemView
public static QHeaderView fromNativePointer(QNativePointer nativePointer)
nativePointer
- the QNativePointer of which object should be returned.protected final void initStyleOption(QStyleOptionHeader option)
|
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |