![]() |
Qt 6.x
The Qt SDK
|
The QTreeView class provides a default model/view implementation of a tree view. More...
#include <qtreeview.h>
Public Slots | |
void | hideColumn (int column) |
Hides the column given. | |
void | showColumn (int column) |
Shows the given column in the tree view. | |
void | expand (const QModelIndex &index) |
Expands the model item specified by the index. | |
void | collapse (const QModelIndex &index) |
Collapses the model item specified by the index. | |
void | resizeColumnToContents (int column) |
Resizes the column given to the size of its contents. | |
void | sortByColumn (int column, Qt::SortOrder order) |
void | expandAll () |
void | expandRecursively (const QModelIndex &index, int depth=-1) |
void | collapseAll () |
void | expandToDepth (int depth) |
![]() | |
virtual void | reset () |
Reset the internal state of the view. | |
virtual void | setRootIndex (const QModelIndex &index) |
Sets the root item to the item at the given index. | |
virtual void | doItemsLayout () |
virtual void | selectAll () |
Selects all items in the view. | |
void | edit (const QModelIndex &index) |
Starts editing the item corresponding to the given index if it is editable. | |
void | clearSelection () |
Deselects all selected items. | |
void | setCurrentIndex (const QModelIndex &index) |
Sets the current item to be the item at index. | |
void | scrollToTop () |
void | scrollToBottom () |
void | update (const QModelIndex &index) |
Signals | |
void | expanded (const QModelIndex &index) |
This signal is emitted when the item specified by index is expanded. | |
void | collapsed (const QModelIndex &index) |
This signal is emitted when the item specified by index is collapsed. | |
![]() | |
void | pressed (const QModelIndex &index) |
This signal is emitted when a mouse button is pressed. | |
void | clicked (const QModelIndex &index) |
This signal is emitted when a mouse button is left-clicked. | |
void | doubleClicked (const QModelIndex &index) |
This signal is emitted when a mouse button is double-clicked. | |
void | activated (const QModelIndex &index) |
This signal is emitted when the item specified by index is activated by the user. | |
void | entered (const QModelIndex &index) |
This signal is emitted when the mouse cursor enters the item specified by index. | |
void | viewportEntered () |
This signal is emitted when the mouse cursor enters the viewport. | |
void | iconSizeChanged (const QSize &size) |
Public Member Functions | |
QTreeView (QWidget *parent=nullptr) | |
Constructs a tree view with a parent to represent a model's data. | |
~QTreeView () | |
Destroys the tree view. | |
void | setModel (QAbstractItemModel *model) override |
\reimp | |
void | setRootIndex (const QModelIndex &index) override |
\reimp | |
void | setSelectionModel (QItemSelectionModel *selectionModel) override |
\reimp | |
QHeaderView * | header () const |
Returns the header for the tree view. | |
void | setHeader (QHeaderView *header) |
Sets the header for the tree view, to the given header. | |
int | autoExpandDelay () const |
void | setAutoExpandDelay (int delay) |
int | indentation () const |
void | setIndentation (int i) |
void | resetIndentation () |
bool | rootIsDecorated () const |
void | setRootIsDecorated (bool show) |
bool | uniformRowHeights () const |
void | setUniformRowHeights (bool uniform) |
bool | itemsExpandable () const |
void | setItemsExpandable (bool enable) |
bool | expandsOnDoubleClick () const |
void | setExpandsOnDoubleClick (bool enable) |
int | columnViewportPosition (int column) const |
Returns the horizontal position of the column in the viewport. | |
int | columnWidth (int column) const |
Returns the width of the column. | |
void | setColumnWidth (int column, int width) |
int | columnAt (int x) const |
Returns the column in the tree view whose header covers the x coordinate given. | |
bool | isColumnHidden (int column) const |
Returns true if the column is hidden; otherwise returns false . | |
void | setColumnHidden (int column, bool hide) |
If hide is true the column is hidden, otherwise the column is shown. | |
bool | isHeaderHidden () const |
void | setHeaderHidden (bool hide) |
bool | isRowHidden (int row, const QModelIndex &parent) const |
Returns true if the item in the given row of the parent is hidden; otherwise returns false . | |
void | setRowHidden (int row, const QModelIndex &parent, bool hide) |
If hide is true the row with the given parent is hidden, otherwise the row is shown. | |
bool | isFirstColumnSpanned (int row, const QModelIndex &parent) const |
void | setFirstColumnSpanned (int row, const QModelIndex &parent, bool span) |
bool | isExpanded (const QModelIndex &index) const |
Returns true if the model item index is expanded; otherwise returns false. | |
void | setExpanded (const QModelIndex &index, bool expand) |
Sets the item referred to by index to either collapse or expanded, depending on the value of expanded. | |
void | setSortingEnabled (bool enable) |
bool | isSortingEnabled () const |
void | setAnimated (bool enable) |
bool | isAnimated () const |
void | setAllColumnsShowFocus (bool enable) |
bool | allColumnsShowFocus () const |
void | setWordWrap (bool on) |
bool | wordWrap () const |
void | setTreePosition (int logicalIndex) |
int | treePosition () const |
void | keyboardSearch (const QString &search) override |
\reimp | |
QRect | visualRect (const QModelIndex &index) const override |
Returns the rectangle on the viewport occupied by the item at index. | |
void | scrollTo (const QModelIndex &index, ScrollHint hint=EnsureVisible) override |
Scroll the contents of the tree view until the given model item index is visible. | |
QModelIndex | indexAt (const QPoint &p) const override |
\reimp | |
QModelIndex | indexAbove (const QModelIndex &index) const |
Returns the model index of the item above index. | |
QModelIndex | indexBelow (const QModelIndex &index) const |
Returns the model index of the item below index. | |
void | doItemsLayout () override |
void | reset () override |
\reimp | |
void | dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles=QList< int >()) override |
\reimp | |
void | selectAll () override |
\reimp | |
![]() | |
QAbstractItemView (QWidget *parent=nullptr) | |
Constructs an abstract item view with the given parent. | |
~QAbstractItemView () | |
Destroys the view. | |
virtual void | setModel (QAbstractItemModel *model) |
Sets the model for the view to present. | |
QAbstractItemModel * | model () const |
Returns the model that this view is presenting. | |
virtual void | setSelectionModel (QItemSelectionModel *selectionModel) |
Sets the current selection model to the given selectionModel. | |
QItemSelectionModel * | selectionModel () const |
Returns the current selection model. | |
void | setItemDelegate (QAbstractItemDelegate *delegate) |
Sets the item delegate for this view and its model to delegate. | |
QAbstractItemDelegate * | itemDelegate () const |
Returns the item delegate used by this view and model. | |
void | setSelectionMode (QAbstractItemView::SelectionMode mode) |
QAbstractItemView::SelectionMode | selectionMode () const |
void | setSelectionBehavior (QAbstractItemView::SelectionBehavior behavior) |
QAbstractItemView::SelectionBehavior | selectionBehavior () const |
QModelIndex | currentIndex () const |
Returns the model index of the current item. | |
QModelIndex | rootIndex () const |
Returns the model index of the model's root item. | |
void | setEditTriggers (EditTriggers triggers) |
EditTriggers | editTriggers () const |
void | setVerticalScrollMode (ScrollMode mode) |
ScrollMode | verticalScrollMode () const |
void | resetVerticalScrollMode () |
void | setHorizontalScrollMode (ScrollMode mode) |
ScrollMode | horizontalScrollMode () const |
void | resetHorizontalScrollMode () |
void | setAutoScroll (bool enable) |
bool | hasAutoScroll () const |
void | setAutoScrollMargin (int margin) |
int | autoScrollMargin () const |
void | setTabKeyNavigation (bool enable) |
bool | tabKeyNavigation () const |
void | setAlternatingRowColors (bool enable) |
bool | alternatingRowColors () const |
void | setIconSize (const QSize &size) |
QSize | iconSize () const |
void | setTextElideMode (Qt::TextElideMode mode) |
Qt::TextElideMode | textElideMode () const |
virtual void | keyboardSearch (const QString &search) |
Moves to and selects the item best matching the string search. | |
virtual QRect | visualRect (const QModelIndex &index) const =0 |
Returns the rectangle on the viewport occupied by the item at index. | |
virtual void | scrollTo (const QModelIndex &index, ScrollHint hint=EnsureVisible)=0 |
Scrolls the view if necessary to ensure that the item at index is visible. | |
virtual QModelIndex | indexAt (const QPoint &point) const =0 |
Returns the model index of the item at the viewport coordinates point. | |
QSize | sizeHintForIndex (const QModelIndex &index) const |
Returns the size hint for the item with the specified index or an invalid size for invalid indexes. | |
virtual int | sizeHintForRow (int row) const |
Returns the height size hint for the specified row or -1 if there is no model. | |
virtual int | sizeHintForColumn (int column) const |
Returns the width size hint for the specified column or -1 if there is no model. | |
void | openPersistentEditor (const QModelIndex &index) |
Opens a persistent editor on the item at the given index. | |
void | closePersistentEditor (const QModelIndex &index) |
Closes the persistent editor for the item at the given index. | |
bool | isPersistentEditorOpen (const QModelIndex &index) const |
void | setIndexWidget (const QModelIndex &index, QWidget *widget) |
QWidget * | indexWidget (const QModelIndex &index) const |
void | setItemDelegateForRow (int row, QAbstractItemDelegate *delegate) |
QAbstractItemDelegate * | itemDelegateForRow (int row) const |
void | setItemDelegateForColumn (int column, QAbstractItemDelegate *delegate) |
QAbstractItemDelegate * | itemDelegateForColumn (int column) const |
virtual QAbstractItemDelegate * | itemDelegateForIndex (const QModelIndex &index) const |
virtual QVariant | inputMethodQuery (Qt::InputMethodQuery query) const override |
\reimp | |
Protected Slots | |
void | columnResized (int column, int oldSize, int newSize) |
This function is called whenever {column}'s size is changed in the header. | |
void | columnCountChanged (int oldCount, int newCount) |
Informs the tree view that the number of columns in the tree view has changed from oldCount to newCount. | |
void | columnMoved () |
This slot is called whenever a column has been moved. | |
void | reexpand () |
void | rowsRemoved (const QModelIndex &parent, int first, int last) |
void | verticalScrollbarValueChanged (int value) override |
![]() | |
virtual void | dataChanged (const QModelIndex &topLeft, const QModelIndex &bottomRight, const QList< int > &roles=QList< int >()) |
This slot is called when items with the given roles are changed in the model. | |
virtual void | rowsInserted (const QModelIndex &parent, int start, int end) |
This slot is called when rows are inserted. | |
virtual void | rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end) |
This slot is called when rows are about to be removed. | |
virtual void | selectionChanged (const QItemSelection &selected, const QItemSelection &deselected) |
This slot is called when the selection is changed. | |
virtual void | currentChanged (const QModelIndex ¤t, const QModelIndex &previous) |
This slot is called when a new item becomes the current item. | |
virtual void | updateEditorData () |
virtual void | updateEditorGeometries () |
virtual void | updateGeometries () |
virtual void | verticalScrollbarAction (int action) |
virtual void | horizontalScrollbarAction (int action) |
virtual void | verticalScrollbarValueChanged (int value) |
virtual void | horizontalScrollbarValueChanged (int value) |
virtual void | closeEditor (QWidget *editor, QAbstractItemDelegate::EndEditHint hint) |
Closes the given editor, and releases it. | |
virtual void | commitData (QWidget *editor) |
Commit the data in the editor to the model. | |
virtual void | editorDestroyed (QObject *editor) |
This function is called when the given editor has been destroyed. | |
Protected Member Functions | |
QTreeView (QTreeViewPrivate &dd, QWidget *parent=nullptr) | |
void | scrollContentsBy (int dx, int dy) override |
Scrolls the contents of the tree view by (dx, dy). | |
void | rowsInserted (const QModelIndex &parent, int start, int end) override |
Informs the view that the rows from the start row to the end row inclusive have been inserted into the parent model item. | |
void | rowsAboutToBeRemoved (const QModelIndex &parent, int start, int end) override |
Informs the view that the rows from the start row to the end row inclusive are about to removed from the given parent model item. | |
QModelIndex | moveCursor (CursorAction cursorAction, Qt::KeyboardModifiers modifiers) override |
Move the cursor in the way described by cursorAction, using the information provided by the button modifiers. | |
int | horizontalOffset () const override |
Returns the horizontal offset of the items in the treeview. | |
int | verticalOffset () const override |
Returns the vertical offset of the items in the tree view. | |
void | setSelection (const QRect &rect, QItemSelectionModel::SelectionFlags command) override |
Applies the selection command to the items in or touched by the rectangle, rect. | |
QRegion | visualRegionForSelection (const QItemSelection &selection) const override |
Returns the rectangle from the viewport of the items in the given selection. | |
QModelIndexList | selectedIndexes () const override |
\reimp | |
void | changeEvent (QEvent *event) override |
\reimp | |
void | timerEvent (QTimerEvent *event) override |
\reimp | |
void | paintEvent (QPaintEvent *event) override |
\reimp | |
void | drawTree (QPainter *painter, const QRegion ®ion) const |
virtual void | drawRow (QPainter *painter, const QStyleOptionViewItem &options, const QModelIndex &index) const |
Draws the row in the tree view that contains the model item index, using the painter given. | |
virtual void | drawBranches (QPainter *painter, const QRect &rect, const QModelIndex &index) const |
Draws the branches in the tree view on the same row as the model item index, using the painter given. | |
void | mousePressEvent (QMouseEvent *event) override |
\reimp | |
void | mouseReleaseEvent (QMouseEvent *event) override |
\reimp | |
void | mouseDoubleClickEvent (QMouseEvent *event) override |
\reimp | |
void | mouseMoveEvent (QMouseEvent *event) override |
\reimp | |
void | keyPressEvent (QKeyEvent *event) override |
\reimp | |
bool | viewportEvent (QEvent *event) override |
\reimp | |
void | updateGeometries () override |
\reimp | |
QSize | viewportSizeHint () const override |
\reimp | |
int | sizeHintForColumn (int column) const override |
Returns the size hint for the column's width or -1 if there is no model. | |
int | indexRowSizeHint (const QModelIndex &index) const |
Returns the size hint for the row indicated by index. | |
int | rowHeight (const QModelIndex &index) const |
void | horizontalScrollbarAction (int action) override |
bool | isIndexHidden (const QModelIndex &index) const override |
\reimp | |
void | selectionChanged (const QItemSelection &selected, const QItemSelection &deselected) override |
\reimp | |
void | currentChanged (const QModelIndex ¤t, const QModelIndex &previous) override |
\reimp | |
![]() | |
QAbstractItemView (QAbstractItemViewPrivate &, QWidget *parent=nullptr) | |
virtual QModelIndex | moveCursor (CursorAction cursorAction, Qt::KeyboardModifiers modifiers)=0 |
Returns a QModelIndex object pointing to the next object in the view, based on the given cursorAction and keyboard modifiers specified by modifiers. | |
virtual int | horizontalOffset () const =0 |
Returns the horizontal offset of the view. | |
virtual int | verticalOffset () const =0 |
Returns the vertical offset of the view. | |
virtual bool | isIndexHidden (const QModelIndex &index) const =0 |
Returns true if the item referred to by the given index is hidden in the view, otherwise returns false . | |
virtual void | setSelection (const QRect &rect, QItemSelectionModel::SelectionFlags command)=0 |
Applies the selection flags to the items in or touched by the rectangle, rect. | |
virtual QRegion | visualRegionForSelection (const QItemSelection &selection) const =0 |
Returns the region from the viewport of the items in the given selection. | |
virtual QModelIndexList | selectedIndexes () const |
This convenience function returns a list of all selected and non-hidden item indexes in the view. | |
virtual bool | edit (const QModelIndex &index, EditTrigger trigger, QEvent *event) |
Starts editing the item at index, creating an editor if necessary, and returns true if the view's \l{State} is now EditingState; otherwise returns false . | |
virtual QItemSelectionModel::SelectionFlags | selectionCommand (const QModelIndex &index, const QEvent *event=nullptr) const |
Returns the SelectionFlags to be used when updating a selection model for the specified index. | |
virtual void | initViewItemOption (QStyleOptionViewItem *option) const |
State | state () const |
Returns the item view's state. | |
void | setState (State state) |
Sets the item view's state to the given state. | |
void | scheduleDelayedItemsLayout () |
Schedules a layout of the items in the view to be executed when the event processing starts. | |
void | executeDelayedItemsLayout () |
Executes the scheduled layouts without waiting for the event processing to begin. | |
void | setDirtyRegion (const QRegion ®ion) |
void | scrollDirtyRegion (int dx, int dy) |
Prepares the view for scrolling by ({dx},{dy}) pixels by moving the dirty regions in the opposite direction. | |
QPoint | dirtyRegionOffset () const |
Returns the offset of the dirty regions in the view. | |
void | startAutoScroll () |
void | stopAutoScroll () |
void | doAutoScroll () |
bool | focusNextPrevChild (bool next) override |
\reimp | |
bool | event (QEvent *event) override |
\reimp | |
bool | viewportEvent (QEvent *event) override |
This function is used to handle tool tips, and What's This? mode, if the given event is a QEvent::ToolTip,or a QEvent::WhatsThis. | |
void | mousePressEvent (QMouseEvent *event) override |
This function is called with the given event when a mouse button is pressed while the cursor is inside the widget. | |
void | mouseMoveEvent (QMouseEvent *event) override |
This function is called with the given event when a mouse move event is sent to the widget. | |
void | mouseReleaseEvent (QMouseEvent *event) override |
This function is called with the given event when a mouse button is released, after a mouse press event on the widget. | |
void | mouseDoubleClickEvent (QMouseEvent *event) override |
This function is called with the given event when a mouse button is double clicked inside the widget. | |
void | focusInEvent (QFocusEvent *event) override |
This function is called with the given event when the widget obtains the focus. | |
void | focusOutEvent (QFocusEvent *event) override |
This function is called with the given event when the widget loses the focus. | |
void | keyPressEvent (QKeyEvent *event) override |
This function is called with the given event when a key event is sent to the widget. | |
void | resizeEvent (QResizeEvent *event) override |
This function is called with the given event when a resize event is sent to the widget. | |
void | timerEvent (QTimerEvent *event) override |
This function is called with the given event when a timer event is sent to the widget. | |
void | inputMethodEvent (QInputMethodEvent *event) override |
\reimp | |
bool | eventFilter (QObject *object, QEvent *event) override |
\reimp | |
QSize | viewportSizeHint () const override |
Properties | |
int | autoExpandDelay |
The delay time before items in a tree are opened during a drag and drop operation. | |
int | indentation |
indentation of the items in the tree view. | |
bool | rootIsDecorated |
whether to show controls for expanding and collapsing top-level items | |
bool | uniformRowHeights |
whether all items in the treeview have the same height | |
bool | itemsExpandable |
whether the items are expandable by the user. | |
bool | sortingEnabled |
whether sorting is enabled | |
bool | animated |
whether animations are enabled | |
bool | allColumnsShowFocus |
whether items should show keyboard focus using all columns | |
bool | wordWrap |
the item text word-wrapping policy | |
bool | headerHidden |
whether the header is shown or not. | |
bool | expandsOnDoubleClick |
whether the items can be expanded by double-clicking. | |
![]() | |
bool | autoScroll |
whether autoscrolling in drag move events is enabled | |
int | autoScrollMargin |
the size of the area when auto scrolling is triggered | |
EditTriggers | editTriggers |
which actions will initiate item editing | |
bool | tabKeyNavigation |
whether item navigation with tab and backtab is enabled. | |
bool | alternatingRowColors |
whether to draw the background using alternating colors | |
SelectionMode | selectionMode |
which selection mode the view operates in | |
SelectionBehavior | selectionBehavior |
which selection behavior the view uses | |
QSize | iconSize |
the size of items' icons | |
Qt::TextElideMode | textElideMode |
the position of the "..." in elided text. | |
ScrollMode | verticalScrollMode |
how the view scrolls its contents in the vertical direction | |
ScrollMode | horizontalScrollMode |
how the view scrolls its contents in the horizontal direction | |
Friends | |
class | ::tst_QTreeView |
class | QAccessibleTable |
class | QAccessibleTree |
class | QAccessibleTableCell |
Additional Inherited Members | |
![]() | |
enum | SelectionMode { NoSelection , SingleSelection , MultiSelection , ExtendedSelection , ContiguousSelection } |
This enum indicates how the view responds to user selections: More... | |
enum | SelectionBehavior { SelectItems , SelectRows , SelectColumns } |
\value SelectItems Selecting single items. More... | |
enum | ScrollHint { EnsureVisible , PositionAtTop , PositionAtBottom , PositionAtCenter } |
\value EnsureVisible Scroll to ensure that the item is visible. More... | |
enum | EditTrigger { NoEditTriggers = 0 , CurrentChanged = 1 , DoubleClicked = 2 , SelectedClicked = 4 , EditKeyPressed = 8 , AnyKeyPressed = 16 , AllEditTriggers = 31 } |
This enum describes actions which will initiate item editing. More... | |
enum | ScrollMode { ScrollPerItem , ScrollPerPixel } |
![]() | |
enum | CursorAction { MoveUp , MoveDown , MoveLeft , MoveRight , MoveHome , MoveEnd , MovePageUp , MovePageDown , MoveNext , MovePrevious } |
This enum describes the different ways to navigate between items,. More... | |
enum | State { NoState , DraggingState , DragSelectingState , EditingState , ExpandingState , CollapsingState , AnimatingState } |
Describes the different states the view can be in. More... | |
The QTreeView class provides a default model/view implementation of a tree view.
\inmodule QtWidgets
A QTreeView implements a tree representation of items from a model. This class is used to provide standard hierarchical lists that were previously provided by the QListView
class, but using the more flexible approach provided by Qt's model/view architecture.
The QTreeView class is one of the \l{Model/View Classes} and is part of Qt's \l{Model/View Programming}{model/view framework}.
QTreeView implements the interfaces defined by the QAbstractItemView class to allow it to display data provided by models derived from the QAbstractItemModel class.
It is simple to construct a tree view displaying data from a model. In the following example, the contents of a directory are supplied by a QFileSystemModel and displayed as a tree:
The model/view architecture ensures that the contents of the tree view are updated as the model changes.
Items that have children can be in an expanded (children are visible) or collapsed (children are hidden) state. When this state changes a collapsed() or expanded() signal is emitted with the model index of the relevant item.
The amount of indentation used to indicate levels of hierarchy is controlled by the \l indentation property.
Headers in tree views are constructed using the QHeaderView class and can be hidden using {header()->hide()}. Note that each header is configured with its \l{QHeaderView::}{stretchLastSection} 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.
By default, all columns in a tree view are movable except the first. To disable movement of these columns, use QHeaderView's \l {QHeaderView::}{setSectionsMovable()} function. For more information about rearranging sections, see \l {Moving Header Sections}.
Definition at line 19 of file qtreeview.h.
Constructs a tree view with a parent to represent a model's data.
Use setModel() to set the model.
Definition at line 150 of file qtreeview.cpp.
References d.
QTreeView::~QTreeView | ( | ) |
Destroys the tree view.
Definition at line 170 of file qtreeview.cpp.
|
protected |
Definition at line 160 of file qtreeview.cpp.
References d.
bool QTreeView::allColumnsShowFocus | ( | ) | const |
Definition at line 902 of file qtreeview.cpp.
References d.
int QTreeView::autoExpandDelay | ( | ) | const |
Definition at line 315 of file qtreeview.cpp.
References d.
|
slot |
Collapses the model item specified by the index.
Definition at line 760 of file qtreeview.cpp.
References collapsed(), d, emit, i, updateGeometries(), and viewport().
Referenced by QTreeWidget::collapseItem(), keyPressEvent(), and setExpanded().
|
slot |
Collapses all expanded items.
Definition at line 2736 of file qtreeview.cpp.
References collapsed(), QSet< T >::constBegin(), QSet< T >::constEnd(), d, doItemsLayout(), emit, QPersistentModelIndex::flags(), QMetaMethod::fromSignal(), i, QPersistentModelIndex::isValid(), and Qt::ItemNeverHasChildren.
|
signal |
This signal is emitted when the item specified by index is collapsed.
Referenced by QTreeWidget::QTreeWidget(), collapse(), collapseAll(), and expandToDepth().
int QTreeView::columnAt | ( | int | x | ) | const |
Returns the column in the tree view whose header covers the x coordinate given.
Definition at line 500 of file qtreeview.cpp.
References d.
|
protectedslot |
Informs the tree view that the number of columns in the tree view has changed from oldCount to newCount.
Definition at line 2563 of file qtreeview.cpp.
References d, isVisible(), updateGeometries(), and viewport().
Referenced by setHeader().
|
protectedslot |
This slot is called whenever a column has been moved.
Definition at line 2480 of file qtreeview.cpp.
References d, and QAbstractItemView::updateEditorGeometries().
Referenced by setHeader().
|
protectedslot |
This function is called whenever {column}'s size is changed in the header.
oldSize and newSize give the previous size and the new size in pixels.
Definition at line 2812 of file qtreeview.cpp.
References d.
Referenced by setHeader().
int QTreeView::columnViewportPosition | ( | int | column | ) | const |
Returns the horizontal position of the column in the viewport.
Definition at line 466 of file qtreeview.cpp.
References d.
Referenced by drawRow(), scrollTo(), timerEvent(), visualRect(), and visualRegionForSelection().
int QTreeView::columnWidth | ( | int | column | ) | const |
Returns the width of the column.
Definition at line 477 of file qtreeview.cpp.
References d.
Referenced by scrollTo(), timerEvent(), visualRect(), and visualRegionForSelection().
|
overrideprotectedvirtual |
\reimp
Reimplemented from QAbstractItemView.
Definition at line 3999 of file qtreeview.cpp.
References allColumnsShowFocus, QAbstractItemView::currentChanged(), d, QModelIndex::isValid(), QRect::setWidth(), QRect::setX(), viewport(), and visualRect().
|
overridevirtual |
\reimp
Reimplemented from QAbstractItemView.
Definition at line 640 of file qtreeview.cpp.
References QModelIndex::column(), d, QAbstractItemView::dataChanged(), i, indexRowSizeHint(), and QModelIndex::row().
|
overridevirtual |
Lays out the items in the tree view.
Reimplemented from QAbstractItemView.
Definition at line 2090 of file qtreeview.cpp.
References d, QAbstractItemView::doItemsLayout(), it, and parent.
Referenced by collapseAll(), hideColumn(), and showColumn().
|
protectedvirtual |
Draws the branches in the tree view on the same row as the model item index, using the painter given.
The branches are drawn in the rectangle specified by rect.
Definition at line 1815 of file qtreeview.cpp.
References QPainter::brushOrigin(), d, expanded(), QTreeViewItem::expanded, QStyleOptionButton::features, QTreeViewItem::hasChildren, QTreeViewItem::hasMoreSiblings, QAbstractItemView::initViewItemOption(), item, QTreeViewItem::level, opt, painter, QModelIndex::parent(), parent, QStyle::PE_IndicatorBranch, rect, QStyleOption::rect, QModelIndex::row(), QAbstractItemView::ScrollPerPixel, QAbstractItemView::selectionBehavior, QAbstractItemView::SelectRows, QPainter::setBrushOrigin(), QStyleOption::state, QStyle::State_Active, QStyle::State_Children, QStyle::State_Enabled, QStyle::State_Item, QStyle::State_MouseOver, QStyle::State_None, QStyle::State_Open, QStyle::State_Selected, QStyle::State_Sibling, QTreeViewItem::total, verticalOffset(), and QAbstractItemView::verticalScrollMode.
Referenced by drawRow().
|
protectedvirtual |
Draws the row in the tree view that contains the model item index, using the painter given.
The option controls how the item is displayed.
Definition at line 1608 of file qtreeview.cpp.
References QPalette::Active, allColumnsShowFocus, ancestorOf(), QList< T >::at(), columnViewportPosition(), QHeaderView::count(), QAbstractItemView::currentIndex(), d, QPalette::Disabled, drawBranches(), QStyleOptionButton::features, QApplication::focusWidget(), header(), QPalette::Highlight, i, QPalette::Inactive, QAbstractItemView::indexWidget(), QModelIndex::isValid(), QAbstractItemView::itemDelegateForIndex(), Qt::ItemIsEnabled, QHeaderView::length(), QHeaderView::logicalIndex(), QPalette::Normal, o, QHeaderView::offset(), opt, QAbstractItemDelegate::paint(), painter, QStyleOption::palette, QModelIndex::parent(), parent, QStyle::PE_FrameFocusRect, QStyle::PE_PanelItemViewRow, position(), QStyleOption::rect, QPainter::restore(), QModelIndex::row(), QPainter::save(), QHeaderView::sectionPosition(), QHeaderView::sectionSize(), QHeaderView::sectionsMoved(), QAbstractItemView::selectionBehavior, QAbstractItemView::SelectRows, QPainter::setClipRect(), QPalette::setCurrentColorGroup(), QRect::setRect(), QStyle::SH_ItemView_ShowDecorationSelected, QList< T >::size(), QAbstractItemView::state(), QStyleOption::state, QStyle::State_Active, QStyle::State_Enabled, QStyle::State_HasFocus, QStyle::State_KeyboardFocusChange, QStyle::State_MouseOver, QStyle::State_Selected, QHeaderView::visualIndex(), QRect::width(), and QPalette::Window.
Referenced by drawTree().
Definition at line 1449 of file qtreeview.cpp.
References QList< T >::append(), area(), QList< T >::at(), QRect::bottom(), QRegion::boundingRect(), QListSpecialMethodsBase< T >::contains(), d, drawRow(), i, QAbstractItemView::initViewItemOption(), painter, QCursor::pos(), QRegion::rectCount(), QList< T >::size(), QAbstractItemView::state(), QStyle::State_Children, QStyle::State_None, QStyle::State_Open, and QStyle::State_Sibling.
Referenced by paintEvent().
|
slot |
Expands the model item specified by the index.
Definition at line 725 of file qtreeview.cpp.
References d, emit, expanded(), i, Qt::ItemNeverHasChildren, and updateGeometries().
Referenced by QTreeWidget::expandItem(), expandRecursively(), keyPressEvent(), scrollTo(), and setExpanded().
|
slot |
Definition at line 2672 of file qtreeview.cpp.
References d, and updateGeometries().
|
signal |
This signal is emitted when the item specified by index is expanded.
Referenced by QTreeWidget::QTreeWidget(), drawBranches(), expand(), expandRecursively(), expandToDepth(), and setExpanded().
|
slot |
Definition at line 2697 of file qtreeview.cpp.
References child, d, emit, expand(), expanded(), QList< T >::isEmpty(), parent, QStack< T >::pop(), and QStack< T >::push().
Referenced by keyPressEvent().
bool QTreeView::expandsOnDoubleClick | ( | ) | const |
Definition at line 451 of file qtreeview.cpp.
References d.
|
slot |
Definition at line 2762 of file qtreeview.cpp.
References collapsed(), QSet< T >::constBegin(), QSet< T >::constEnd(), d, emit, expanded(), QPersistentModelIndex::flags(), QMetaMethod::fromSignal(), i, QPersistentModelIndex::isValid(), Qt::ItemNeverHasChildren, and updateGeometries().
QHeaderView * QTreeView::header | ( | ) | const |
Returns the header for the tree view.
Definition at line 258 of file qtreeview.cpp.
References d.
Referenced by QTreeWidget::QTreeWidget(), drawRow(), QTreeWidgetItem::isHidden(), moveCursor(), resizeColumnToContents(), QFileDialogTreeView::setFileDialogPrivate(), setHeader(), QTreeWidgetItem::setHidden(), setModel(), setSortingEnabled(), QComboBox::showPopup(), QFileDialogTreeView::sizeHint(), QTreeWidget::sortColumn(), QTreeWidget::sortItems(), and QTreeWidget::visualItemRect().
|
slot |
Hides the column given.
Definition at line 695 of file qtreeview.cpp.
References d, and doItemsLayout().
|
overrideprotectedvirtual |
Returns the horizontal offset of the items in the treeview.
Note that the tree view uses the horizontal header section positions to determine the positions of columns in the view.
Implements QAbstractItemView.
Definition at line 2141 of file qtreeview.cpp.
References d.
Referenced by scrollTo().
|
overrideprotectedvirtual |
Reimplemented from QAbstractItemView.
Definition at line 3029 of file qtreeview.cpp.
References QAbstractItemView::horizontalScrollbarAction().
int QTreeView::indentation | ( | ) | const |
Definition at line 340 of file qtreeview.cpp.
References d.
QModelIndex QTreeView::indexAbove | ( | const QModelIndex & | index | ) | const |
Returns the model index of the item above index.
Definition at line 2056 of file qtreeview.cpp.
References d, i, QModelIndex::row(), and QModelIndex::sibling().
Referenced by QTreeWidget::itemAbove().
|
overridevirtual |
\reimp
Implements QAbstractItemView.
Definition at line 2032 of file qtreeview.cpp.
References QModelIndex::column(), d, QModelIndex::isValid(), QModelIndex::row(), QModelIndex::sibling(), QPoint::x(), and QPoint::y().
Referenced by QTreeWidget::itemAt(), mouseDoubleClickEvent(), setSelection(), timerEvent(), and viewportEvent().
QModelIndex QTreeView::indexBelow | ( | const QModelIndex & | index | ) | const |
Returns the model index of the item below index.
Definition at line 2072 of file qtreeview.cpp.
References d, i, QModelIndex::row(), and QModelIndex::sibling().
Referenced by QTreeWidget::itemBelow(), and keyboardSearch().
|
protected |
Returns the size hint for the row indicated by index.
Definition at line 2948 of file qtreeview.cpp.
References d, QSize::height(), hint(), QAbstractItemView::initViewItemOption(), QModelIndex::isValid(), isVisible(), QAbstractItemView::itemDelegateForIndex(), parent, qBound(), qMax(), qSwap(), and QAbstractItemDelegate::sizeHint().
Referenced by dataChanged().
bool QTreeView::isAnimated | ( | ) | const |
Definition at line 876 of file qtreeview.cpp.
References d.
bool QTreeView::isColumnHidden | ( | int | column | ) | const |
Returns true
if the column is hidden; otherwise returns false
.
Definition at line 511 of file qtreeview.cpp.
References d.
Referenced by isIndexHidden(), and moveCursor().
bool QTreeView::isExpanded | ( | const QModelIndex & | index | ) | const |
Returns true
if the model item index is expanded; otherwise returns false.
Definition at line 797 of file qtreeview.cpp.
References d.
Referenced by QTreeWidgetItem::isExpanded(), scrollTo(), QComboBox::showPopup(), timerEvent(), and verticalScrollbarValueChanged().
bool QTreeView::isFirstColumnSpanned | ( | int | row, |
const QModelIndex & | parent | ||
) | const |
Returns true
if the item in first column in the given row of the parent is spanning all the columns; otherwise returns false
.
Definition at line 597 of file qtreeview.cpp.
Referenced by QTreeWidgetItem::isFirstColumnSpanned().
bool QTreeView::isHeaderHidden | ( | ) | const |
Definition at line 540 of file qtreeview.cpp.
References d.
|
overrideprotectedvirtual |
\reimp
Implements QAbstractItemView.
Definition at line 3037 of file qtreeview.cpp.
References isColumnHidden(), and isRowHidden().
Referenced by selectedIndexes(), visualRect(), and visualRegionForSelection().
bool QTreeView::isRowHidden | ( | int | row, |
const QModelIndex & | parent | ||
) | const |
Returns true
if the item in the given row of the parent is hidden; otherwise returns false
.
Definition at line 558 of file qtreeview.cpp.
Referenced by QTreeWidgetItem::isHidden(), and isIndexHidden().
bool QTreeView::isSortingEnabled | ( | ) | const |
Definition at line 851 of file qtreeview.cpp.
References d.
Referenced by QTreeWidgetItem::insertChild(), and QTreeWidgetItem::insertChildren().
bool QTreeView::itemsExpandable | ( | ) | const |
Definition at line 429 of file qtreeview.cpp.
References d.
\reimp
Reimplemented from QAbstractItemView.
Definition at line 970 of file qtreeview.cpp.
References QAbstractItemView::currentIndex(), d, Qt::DisplayRole, i, indexBelow(), QString::isEmpty(), QModelIndex::isValid(), QApplication::keyboardInputInterval, match(), QModelIndex::parent(), qMin(), QModelIndex::row(), QAbstractItemView::setCurrentIndex(), and QModelIndex::sibling().
\reimp
Definition at line 2007 of file qtreeview.cpp.
References collapse(), QAbstractItemView::currentIndex(), d, expand(), expandRecursively(), Qt::Key_Asterisk, Qt::Key_Minus, Qt::Key_Plus, and QAbstractItemView::keyPressEvent().
Referenced by QFileDialogTreeView::keyPressEvent().
|
overrideprotected |
\reimp
Definition at line 1938 of file qtreeview.cpp.
References QAbstractItemView::activated(), d, QAbstractItemView::DoubleClicked, QAbstractItemView::doubleClicked(), QAbstractItemView::edit(), emit, i, indexAt(), QPersistentModelIndex::isValid(), mousePressEvent(), QAbstractItemView::NoState, QStyle::SH_ItemView_ActivateItemOnSingleClick, QAbstractItemView::state(), updateGeometries(), and viewport().
|
overrideprotected |
\reimp
Definition at line 1997 of file qtreeview.cpp.
References d, and QAbstractItemView::mouseMoveEvent().
|
overrideprotected |
\reimp
Definition at line 1907 of file qtreeview.cpp.
References d, QEvent::MouseButtonPress, QAbstractItemView::mousePressEvent(), and QStyle::SH_ListViewExpand_SelectMouseType.
Referenced by mouseDoubleClickEvent().
|
overrideprotected |
\reimp
Definition at line 1922 of file qtreeview.cpp.
References d, QAbstractItemView::DraggingState, QAbstractItemView::DragSelectingState, QEvent::MouseButtonRelease, QAbstractItemView::mouseReleaseEvent(), QAbstractItemView::NoState, QAbstractItemView::setState(), QStyle::SH_ListViewExpand_SelectMouseType, and QAbstractItemView::state().
|
overrideprotectedvirtual |
Move the cursor in the way described by cursorAction, using the information provided by the button modifiers.
Implements QAbstractItemView.
Definition at line 2176 of file qtreeview.cpp.
References QModelIndex::column(), QAbstractItemModel::columnCount(), QHeaderView::count(), QAbstractItemView::currentIndex(), d, header(), i, isColumnHidden(), QModelIndex::isValid(), QAbstractSlider::minimum, QAbstractItemView::model(), QAbstractItemView::MoveDown, QAbstractItemView::MoveEnd, QAbstractItemView::MoveHome, QAbstractItemView::MoveLeft, QAbstractItemView::MoveNext, QAbstractItemView::MovePageDown, QAbstractItemView::MovePageUp, QAbstractItemView::MovePrevious, QAbstractItemView::MoveRight, QAbstractItemView::MoveUp, next, QModelIndex::parent(), Q_UNUSED, qMax(), QAbstractItemView::rootIndex(), QModelIndex::row(), QAbstractItemView::SelectColumns, QAbstractItemView::SelectItems, QAbstractSlider::setValue(), QStyle::SH_ItemView_ArrowKeysNavigateIntoChildren, QModelIndex::sibling(), QAbstractSlider::singleStep, updateGeometries(), QAbstractSlider::value, and viewport().
|
overrideprotected |
\reimp
Definition at line 1300 of file qtreeview.cpp.
References d, drawTree(), painter, and viewport().
|
protectedslot |
Definition at line 2490 of file qtreeview.cpp.
|
overridevirtual |
\reimp
Reimplemented from QAbstractItemView.
Definition at line 2123 of file qtreeview.cpp.
References d, and QAbstractItemView::reset().
void QTreeView::resetIndentation | ( | ) |
Definition at line 356 of file qtreeview.cpp.
References d.
|
slot |
Resizes the column given to the size of its contents.
Definition at line 2581 of file qtreeview.cpp.
References contents, d, header(), qMax(), and sizeHintForColumn().
Referenced by setHeader().
bool QTreeView::rootIsDecorated | ( | ) | const |
Definition at line 376 of file qtreeview.cpp.
References d.
|
protected |
Definition at line 3016 of file qtreeview.cpp.
|
overrideprotectedvirtual |
Informs the view that the rows from the start row to the end row inclusive are about to removed from the given parent model item.
Reimplemented from QAbstractItemView.
Definition at line 2537 of file qtreeview.cpp.
References d, parent, and QAbstractItemView::rowsAboutToBeRemoved().
|
overrideprotectedvirtual |
Informs the view that the rows from the start row to the end row inclusive have been inserted into the parent model item.
Reimplemented from QAbstractItemView.
Definition at line 2499 of file qtreeview.cpp.
References d, parent, QAbstractItemView::rowsInserted(), and viewport().
|
protectedslot |
Informs the view that the rows from the start row to the end row inclusive have been removed from the given parent model item.
Definition at line 2550 of file qtreeview.cpp.
Referenced by setModel().
|
overrideprotected |
Scrolls the contents of the tree view by (dx, dy).
Definition at line 2425 of file qtreeview.cpp.
References d, QAbstractItemView::horizontalScrollMode, i, qAbs(), qMin(), QAbstractItemView::ScrollPerItem, QAbstractItemView::sizeHintForRow(), and QAbstractItemView::verticalScrollMode.
|
overridevirtual |
Scroll the contents of the tree view until the given model item index is visible.
The hint parameter specifies more precisely where the item should be located after the operation. If any of the parents of the model item are collapsed, they will be expanded to ensure that the model item is visible.
Implements QAbstractItemView.
Definition at line 1107 of file qtreeview.cpp.
References area(), columnViewportPosition(), columnWidth(), d, QAbstractItemView::EnsureVisible, expand(), hint(), horizontalOffset(), isExpanded(), item, QAbstractItemView::NoState, parent, QAbstractItemView::PositionAtBottom, QAbstractItemView::PositionAtCenter, QAbstractItemView::PositionAtTop, rect, QAbstractItemView::ScrollPerItem, QAbstractItemView::state(), and QAbstractItemView::verticalScrollMode.
Referenced by QTreeWidget::scrollToItem(), and src_gui_itemviews_qstandarditemmodel::wrapper3().
|
overridevirtual |
\reimp
Reimplemented from QAbstractItemView.
Definition at line 2619 of file qtreeview.cpp.
References QItemSelectionModel::ClearAndSelect, d, QAbstractItemView::NoSelection, QModelIndex::parent(), QModelIndex::row(), QItemSelectionModel::Rows, QAbstractItemView::selectionModel(), QModelIndex::sibling(), and QAbstractItemView::SingleSelection.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QAbstractItemView.
Definition at line 2404 of file qtreeview.cpp.
References QList< T >::append(), QList< T >::at(), i, isIndexHidden(), QModelIndex::parent(), QItemSelectionModel::selectedIndexes, QAbstractItemView::selectionModel(), and QList< T >::size().
|
overrideprotectedvirtual |
\reimp
Reimplemented from QAbstractItemView.
Definition at line 4031 of file qtreeview.cpp.
References d, QItemSelection::indexes(), QModelIndex::isValid(), Q_ASSERT, QAbstractItemView::selectionChanged(), and QList< T >::value().
void QTreeView::setAllColumnsShowFocus | ( | bool | enable | ) |
Definition at line 893 of file qtreeview.cpp.
References d.
void QTreeView::setAnimated | ( | bool | enable | ) |
Definition at line 870 of file qtreeview.cpp.
References d.
void QTreeView::setAutoExpandDelay | ( | int | delay | ) |
Definition at line 321 of file qtreeview.cpp.
References d.
void QTreeView::setColumnHidden | ( | int | column, |
bool | hide | ||
) |
If hide is true the column is hidden, otherwise the column is shown.
Definition at line 522 of file qtreeview.cpp.
void QTreeView::setColumnWidth | ( | int | column, |
int | width | ||
) |
Sets the width of the given column to the width specified.
Definition at line 490 of file qtreeview.cpp.
References d.
void QTreeView::setExpanded | ( | const QModelIndex & | index, |
bool | expanded | ||
) |
Sets the item referred to by index to either collapse or expanded, depending on the value of expanded.
Definition at line 809 of file qtreeview.cpp.
References collapse(), expand(), and expanded().
Referenced by QTreeWidgetItem::setExpanded(), and timerEvent().
void QTreeView::setExpandsOnDoubleClick | ( | bool | enable | ) |
Definition at line 457 of file qtreeview.cpp.
References d.
void QTreeView::setFirstColumnSpanned | ( | int | row, |
const QModelIndex & | parent, | ||
bool | span | ||
) |
If span is true the item in the first column in the row with the given parent is set to span all columns, otherwise all items on the row are shown.
Definition at line 615 of file qtreeview.cpp.
Referenced by QTreeWidgetItem::setFirstColumnSpanned().
void QTreeView::setHeader | ( | QHeaderView * | header | ) |
Sets the header for the tree view, to the given header.
The view takes ownership over the given header and deletes it when a new header is set.
Definition at line 272 of file qtreeview.cpp.
References columnCountChanged(), columnMoved(), columnResized(), connect(), d, header(), resizeColumnToContents(), setSortingEnabled(), SIGNAL, SLOT, and updateGeometries().
void QTreeView::setHeaderHidden | ( | bool | hide | ) |
void QTreeView::setIndentation | ( | int | i | ) |
Definition at line 346 of file qtreeview.cpp.
void QTreeView::setItemsExpandable | ( | bool | enable | ) |
Definition at line 435 of file qtreeview.cpp.
References d.
Referenced by QFileDialogTreeView::setFileDialogPrivate().
|
overridevirtual |
\reimp
Reimplemented from QAbstractItemView.
Reimplemented in QTreeWidget.
Definition at line 177 of file qtreeview.cpp.
References connect(), d, disconnect(), header(), QAbstractItemView::model(), rowsRemoved(), QAbstractItemView::setModel(), SIGNAL, SLOT, and QAbstractItemModelPrivate::staticEmptyModel().
Referenced by QTreeWidget::QTreeWidget(), Widget::Widget(), main(), and src_gui_itemviews_qstandarditemmodel::MyWidget::wrapper2().
|
overridevirtual |
\reimp
Reimplemented from QAbstractItemView.
Definition at line 223 of file qtreeview.cpp.
References d, and QAbstractItemView::setRootIndex().
Referenced by main().
void QTreeView::setRootIsDecorated | ( | bool | show | ) |
Definition at line 382 of file qtreeview.cpp.
Referenced by QFileDialogTreeView::setFileDialogPrivate().
void QTreeView::setRowHidden | ( | int | row, |
const QModelIndex & | parent, | ||
bool | hide | ||
) |
If hide is true the row with the given parent is hidden, otherwise the row is shown.
Definition at line 571 of file qtreeview.cpp.
References d, hide(), and parent.
Referenced by QTreeWidgetItem::setHidden().
|
overrideprotectedvirtual |
Applies the selection command to the items in or touched by the rectangle, rect.
Implements QAbstractItemView.
Definition at line 2308 of file qtreeview.cpp.
References QItemSelectionModel::Clear, QItemSelectionModel::clear(), d, indexAt(), QModelIndex::isValid(), qMax(), qMin(), rect, QAbstractItemView::selectionModel(), and QModelIndex::sibling().
|
overridevirtual |
\reimp
Reimplemented from QAbstractItemView.
Reimplemented in QTreeWidget.
Definition at line 233 of file qtreeview.cpp.
References connect(), d, disconnect(), Q_ASSERT, QAbstractItemView::selectionModel(), QAbstractItemView::setSelectionModel(), SIGNAL, and SLOT.
Referenced by main(), and QTreeWidget::setSelectionModel().
void QTreeView::setSortingEnabled | ( | bool | enable | ) |
Definition at line 833 of file qtreeview.cpp.
References connect(), d, disconnect(), header(), QHeaderView::setSectionsClickable(), QHeaderView::setSortIndicatorShown(), SIGNAL, SLOT, sortByColumn(), and Qt::UniqueConnection.
Referenced by Widget::Widget(), QFileDialogTreeView::setFileDialogPrivate(), and setHeader().
void QTreeView::setTreePosition | ( | int | index | ) |
This specifies that the tree structure should be placed at logical index index. If \index is set to -1 then the tree will always follow visual index 0.
Definition at line 945 of file qtreeview.cpp.
References d.
void QTreeView::setUniformRowHeights | ( | bool | uniform | ) |
Definition at line 413 of file qtreeview.cpp.
References d.
void QTreeView::setWordWrap | ( | bool | on | ) |
Definition at line 921 of file qtreeview.cpp.
References d.
|
slot |
Shows the given column in the tree view.
Definition at line 709 of file qtreeview.cpp.
References d, and doItemsLayout().
|
overrideprotectedvirtual |
Returns the size hint for the column's width or -1 if there is no model.
If you need to set the width of a given column to a fixed value, call QHeaderView::resizeSection() on the view's header.
If you reimplement this function in a subclass, note that the value you return is only used when resizeColumnToContents() is called. In that case, if a larger column width is required by either the view's header or the item delegate, that width will be used instead.
Reimplemented from QAbstractItemView.
Definition at line 2860 of file qtreeview.cpp.
References QList< T >::at(), d, i, QAbstractItemView::initViewItemOption(), qMax(), QList< T >::size(), and viewport().
Referenced by resizeColumnToContents().
|
slot |
Sorts the model by the values in the given column and order.
column may be -1, in which case no sort indicator will be shown and the model will return to its natural, unsorted order. Note that not all models support this and may even crash in this case.
Definition at line 2603 of file qtreeview.cpp.
References d.
Referenced by setSortingEnabled().
|
overrideprotected |
\reimp
Definition at line 1222 of file qtreeview.cpp.
References columnViewportPosition(), columnWidth(), d, QAbstractItemView::DraggingState, i, indexAt(), isExpanded(), pos, QCursor::pos(), rect, setExpanded(), QAbstractItemView::state(), QAbstractItemView::timerEvent(), and updateGeometries().
int QTreeView::treePosition | ( | ) | const |
Return the logical index the tree is set on. If the return value is -1 then the tree is placed on the visual index 0.
Definition at line 961 of file qtreeview.cpp.
References d.
bool QTreeView::uniformRowHeights | ( | ) | const |
Definition at line 407 of file qtreeview.cpp.
References d.
|
overrideprotectedvirtual |
\reimp
Reimplemented from QAbstractItemView.
Definition at line 2823 of file qtreeview.cpp.
References d, QMetaObject::invokeMethod(), QRect::left(), qMax(), qMin(), QRect::top(), QAbstractItemView::updateGeometries(), and QRect::width().
Referenced by collapse(), columnCountChanged(), expand(), expandAll(), expandToDepth(), mouseDoubleClickEvent(), moveCursor(), setHeader(), and timerEvent().
|
overrideprotectedvirtual |
Returns the vertical offset of the items in the tree view.
Implements QAbstractItemView.
Definition at line 2152 of file qtreeview.cpp.
References d, i, qMin(), and QAbstractItemView::ScrollPerItem.
Referenced by drawBranches().
|
overrideprotectedslot |
Definition at line 4071 of file qtreeview.cpp.
References d, isExpanded(), ret, and QAbstractItemView::verticalScrollbarValueChanged().
|
overrideprotected |
\reimp
\reimp
Definition at line 1271 of file qtreeview.cpp.
References d, QEvent::HoverEnter, QEvent::HoverLeave, QEvent::HoverMove, indexAt(), QSinglePointEvent::position(), rect, QPointF::toPoint(), viewport(), QAbstractItemView::viewportEvent(), and visualRect().
|
overrideprotected |
\reimp
Definition at line 2638 of file qtreeview.cpp.
References QRect::bottom(), d, QRect::isValid(), QAbstractItemView::viewportSizeHint(), and visualRect().
|
overridevirtual |
Returns the rectangle on the viewport occupied by the item at index.
If the index is not visible or explicitly hidden, the returned rectangle is invalid.
Implements QAbstractItemView.
Definition at line 1067 of file qtreeview.cpp.
References columnViewportPosition(), columnWidth(), d, i, and isIndexHidden().
Referenced by currentChanged(), viewportEvent(), viewportSizeHint(), QTreeWidget::visualItemRect(), and visualRegionForSelection().
|
overrideprotectedvirtual |
Returns the rectangle from the viewport of the items in the given selection.
Since 4.7, the returned region only contains rectangles intersecting (or included in) the viewport.
Implements QAbstractItemView.
Definition at line 2347 of file qtreeview.cpp.
References QRect::bottom(), QModelIndex::column(), columnViewportPosition(), columnWidth(), d, QRect::intersects(), QList< T >::isEmpty(), isIndexHidden(), QModelIndex::isValid(), parent, QModelIndex::row(), selection, QRect::setX(), QRect::top(), and visualRect().
bool QTreeView::wordWrap | ( | ) | const |
Definition at line 930 of file qtreeview.cpp.
References d.
|
friend |
Definition at line 190 of file qtreeview.h.
|
friend |
Definition at line 191 of file qtreeview.h.
|
friend |
Definition at line 193 of file qtreeview.h.
|
friend |
Definition at line 192 of file qtreeview.h.
|
readwrite |
whether items should show keyboard focus using all columns
If this property is true
all columns will show focus, otherwise only one column will show focus.
The default is false.
Definition at line 205 of file qtreeview.h.
Referenced by currentChanged(), and drawRow().
|
readwrite |
whether animations are enabled
If this property is true
the treeview will animate expansion and collapsing of branches. If this property is false
, the treeview will expand or collapse branches immediately without showing the animation.
By default, this property is false
.
Definition at line 205 of file qtreeview.h.
|
readwrite |
The delay time before items in a tree are opened during a drag and drop operation.
This property holds the amount of time in milliseconds that the user must wait over a node before that node will automatically open or close. If the time is set to less then 0 then it will not be activated.
By default, this property has a value of -1, meaning that auto-expansion is disabled.
Definition at line 205 of file qtreeview.h.
|
readwrite |
whether the items can be expanded by double-clicking.
This property holds whether the user can expand and collapse items by double-clicking. The default value is true.
Definition at line 205 of file qtreeview.h.
|
readwrite |
whether the header is shown or not.
If this property is true
, the header is not shown otherwise it is. The default value is false.
Definition at line 205 of file qtreeview.h.
|
readwrite |
indentation of the items in the tree view.
This property holds the indentation measured in pixels of the items for each level in the tree view. For top-level items, the indentation specifies the horizontal distance from the viewport edge to the items in the first column; for child items, it specifies their indentation from their parent items.
By default, the value of this property is style dependent. Thus, when the style changes, this property updates from it. Calling setIndentation() stops the updates, calling resetIndentation() will restore default behavior.
Definition at line 205 of file qtreeview.h.
|
readwrite |
whether the items are expandable by the user.
This property holds whether the user can expand and collapse items interactively.
By default, this property is true
.
Definition at line 205 of file qtreeview.h.
|
readwrite |
whether to show controls for expanding and collapsing top-level items
Items with children are typically shown with controls to expand and collapse them, allowing their children to be shown or hidden. If this property is false, these controls are not shown for top-level items. This can be used to make a single level tree structure appear like a simple list of items.
By default, this property is true
.
Definition at line 205 of file qtreeview.h.
|
readwrite |
whether sorting is enabled
If this property is true
, sorting is enabled for the tree; if the property is false, sorting is not enabled. The default value is false.
Definition at line 205 of file qtreeview.h.
|
readwrite |
whether all items in the treeview have the same height
This property should only be set to true if it is guaranteed that all items in the view has the same height. This enables the view to do some optimizations.
The height is obtained from the first item in the view. It is updated when the data changes on that item.
By default, this property is false
.
Definition at line 205 of file qtreeview.h.
|
readwrite |
the item text word-wrapping policy
If this property is true
then the item text is wrapped where necessary at word-breaks; otherwise it is not wrapped at all. This property is false
by default.
Note that even if wrapping is enabled, the cell will not be expanded to fit all text. Ellipsis will be inserted according to the current \l{QAbstractItemView::}{textElideMode}.
Definition at line 205 of file qtreeview.h.