QTreeView Class Reference

The QTreeView class provides a default model/view implementation of a tree view.

  1. #include <QTreeView>

Inherits: QAbstractItemView.

Inherited by: QHelpContentWidget and QTreeWidget.

Detailed Description

The QTreeView class provides a default model/view implementation of a tree view.

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 Model/View Classes and is part of Qt's 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 QDirModel(obsolete) and displayed as a tree:

  1.     QFileSystemModel *model = new QFileSystemModel;
  2.     model->setRootPath(QDir::currentPath());
  3.     QTreeView *tree = new QTreeView(splitter);
  4.     tree->setModel(model);

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

Key Bindings

QTreeView supports a set of key bindings that enable the user to navigate in the view and interact with the contents of items:

KeyAction
UpMoves the cursor to the item in the same column on the previous row. If the parent of the current item has no more rows to navigate to, the cursor moves to the relevant item in the last row of the sibling that precedes the parent.
DownMoves the cursor to the item in the same column on the next row. If the parent of the current item has no more rows to navigate to, the cursor moves to the relevant item in the first row of the sibling that follows the parent.
LeftHides the children of the current item (if present) by collapsing a branch.
MinusSame as LeftArrow.
RightReveals the children of the current item (if present) by expanding a branch.
PlusSame as RightArrow.
AsteriskExpands all children of the current item (if present).
PageUpMoves the cursor up one page.
PageDownMoves the cursor down one page.
HomeMoves the cursor to an item in the same column of the first row of the first top-level item in the model.
EndMoves the cursor to an item in the same column of the last row of the last top-level item in the model.
F2In editable models, this opens the current item for editing. The Escape key can be used to cancel the editing process and revert any changes to the data displayed.
Screenshot of a Windows XP style tree view

Screenshot of a Windows XP style tree view

Screenshot of a Macintosh style tree view

Screenshot of a Macintosh style tree view

Screenshot of a Plastique style tree view

Screenshot of a Plastique style tree view

A Windows XP style tree view.A Macintosh style tree view.A Plastique style tree view.

Improving Performance

It is possible to give the view hints about the data it is handling in order to improve its performance when displaying large numbers of items. One approach that can be taken for views that are intended to display items with equal heights is to set the uniformRowHeights property to true.

See also QListView, QTreeWidget, View Classes, QAbstractItemModel, QAbstractItemView, and Dir View Example.

Properties

Toggle detailsallColumnsShowFocusallColumnsShowFocus : bool

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

Access functions:

Look up this member in the source code.

Toggle detailsanimatedanimated : bool

This property holds whether animations are enabled

If this property is true the treeview will animate expandsion and collasping 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.

Access functions:

Look up this member in the source code.

Toggle detailsautoExpandDelayautoExpandDelay : int

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

Access functions:

Look up this member in the source code.

Toggle detailsexpandsOnDoubleClickexpandsOnDoubleClick : bool

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

See also itemsExpandable.

Access functions:

Look up this member in the source code.

Toggle detailsheaderHiddenheaderHidden : bool

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

See also header().

Access functions:

Look up this member in the source code.

Toggle detailsindentationindentation : int

This property holds 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, this property has a value of 20.

Access functions:

Look up this member in the source code.

Toggle detailsitemsExpandableitemsExpandable : bool

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

Access functions:

Look up this member in the source code.

Toggle detailsrootIsDecoratedrootIsDecorated : bool

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

Access functions:

Look up this member in the source code.

Toggle detailssortingEnabledsortingEnabled : bool

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

Note: In order to avoid performance issues, it is recommended that sorting is enabled after inserting the items into the tree. Alternatively, you could also insert the items into a list before inserting the items into the tree.

See also sortByColumn().

Access functions:

Look up this member in the source code.

Toggle detailsuniformRowHeightsuniformRowHeights : bool

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

Access functions:

Look up this member in the source code.

Toggle detailswordWrapwordWrap : bool

This property holds 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 textElideMode.

Access functions:

Look up this member in the source code.

    Public Functions

    Toggle details QTreeView

    QTreeViewQTreeView ( QWidget *parent=0 ) ( QWidget *parent=0 )

    Constructs a tree view with a parent to represent a model's data. Use setModel() to set the model.

    See also QAbstractItemModel.

    Look up this member in the source code.

    Toggle details QTreeView

    ~QTreeView~QTreeView () ()

    Destroys the tree view.

    Look up this member in the source code.

    Toggle details int QTreeView

    columnAtcolumnAt ( int x ) ( int x )const

    Returns the column in the tree view whose header covers the x coordinate given.

    Look up this member in the source code.

    Toggle details int QTreeView

    columnViewportPositioncolumnViewportPosition ( int column ) ( int column )const

    Returns the horizontal position of the column in the viewport.

    Look up this member in the source code.

    Toggle details int QTreeView

    columnWidthcolumnWidth ( int column ) ( int column )const

    Returns the width of the column.

    See also resizeColumnToContents() and setColumnWidth().

    Look up this member in the source code.

    Toggle details void QTreeView

    currentChangedcurrentChanged ( const QModelIndex &current , const QModelIndex &previous ...) ( const QModelIndex &current , const QModelIndex &previous ) [virtual protected]

    Reimplemented from QAbstractItemView::currentChanged().

    Look up this member in the source code.

    Toggle details void QTreeView

    dataChangeddataChanged ( const QModelIndex &topLeft , const QModelIndex &bottomRight ...) ( const QModelIndex &topLeft , const QModelIndex &bottomRight ) [virtual]

    Reimplemented from QAbstractItemView::dataChanged().

    Look up this member in the source code.

    Toggle details void QTreeView

    dragMoveEventdragMoveEvent ( QDragMoveEvent *event ) ( QDragMoveEvent *event ) [virtual protected]

    Reimplemented from QWidget::dragMoveEvent().

    Look up this member in the source code.

    Toggle details void QTreeView

    drawBranchesdrawBranches ( QPainter *painter , const QRect &rect , const QModelIndex &index ...) ( QPainter *painter , const QRect &rect , const QModelIndex &index )const [virtual protected]

    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.

    Look up this member in the source code.

    Toggle details void QTreeView

    drawRowdrawRow ( QPainter *painter , const QStyleOptionViewItem &option , const QModelIndex &index ...) ( QPainter *painter , const QStyleOptionViewItem &option , const QModelIndex &index )const [virtual protected]

    Draws the row in the tree view that contains the model item index, using the painter given. The option control how the item is displayed.

    See also setAlternatingRowColors().

    Look up this member in the source code.

    Toggle details void QTreeView

    drawTreedrawTree ( QPainter *painter , const QRegion &region ...) ( QPainter *painter , const QRegion &region )const[protected]

    Draws the part of the tree intersecting the given region using the specified painter.

    See also paintEvent().

    Look up this member in the source code.

    Toggle details QHeaderView * QTreeView

    headerheader () ()const

    Returns the header for the tree view.

    See also setHeader() and QAbstractItemModel::headerData().

    Look up this member in the source code.

    Toggle details int QTreeView

    horizontalOffsethorizontalOffset () ()const [virtual protected]

    Reimplemented from QAbstractItemView::horizontalOffset().

    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.

    See also verticalOffset().

    Look up this member in the source code.

    Toggle details QModelIndex QTreeView

    indexAboveindexAbove ( const QModelIndex &index ) ( const QModelIndex &index )const

    Returns the model index of the item above index.

    Look up this member in the source code.

    Toggle details QModelIndex QTreeView

    indexAtindexAt ( const QPoint &point ) ( const QPoint &point )const [virtual]

    Reimplemented from QAbstractItemView::indexAt().

    Look up this member in the source code.

    Toggle details QModelIndex QTreeView

    indexBelowindexBelow ( const QModelIndex &index ) ( const QModelIndex &index )const

    Returns the model index of the item below index.

    Look up this member in the source code.

    Toggle details int QTreeView

    indexRowSizeHintindexRowSizeHint ( const QModelIndex &index ) ( const QModelIndex &index )const[protected]

    Returns the size hint for the row indicated by index.

    See also sizeHintForColumn() and uniformRowHeights().

    Look up this member in the source code.

    Toggle details bool QTreeView

    isColumnHiddenisColumnHidden ( int column ) ( int column )const

    Returns true if the column is hidden; otherwise returns false.

    See also hideColumn() and isRowHidden().

    Look up this member in the source code.

    Toggle details bool QTreeView

    isExpandedisExpanded ( const QModelIndex &index ) ( const QModelIndex &index )const

    Returns true if the model item index is expanded; otherwise returns false.

    See also expand(), expanded(), and setExpanded().

    Look up this member in the source code.

    Toggle details bool QTreeView

    isFirstColumnSpannedisFirstColumnSpanned ( int row , const QModelIndex &parent ...) ( 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.

    See also setFirstColumnSpanned().

    Look up this member in the source code.

    Toggle details bool QTreeView

    isIndexHiddenisIndexHidden ( const QModelIndex &index ) ( const QModelIndex &index )const [virtual protected]

    Reimplemented from QAbstractItemView::isIndexHidden().

    Look up this member in the source code.

    Toggle details bool QTreeView

    isRowHiddenisRowHidden ( int row , const QModelIndex &parent ...) ( int row , const QModelIndex &parent )const

    Returns true if the item in the given row of the parent is hidden; otherwise returns false.

    See also setRowHidden() and isColumnHidden().

    Look up this member in the source code.

    Toggle details void QTreeView

    keyPressEventkeyPressEvent ( QKeyEvent *event ) ( QKeyEvent *event ) [virtual protected]

    Reimplemented from QWidget::keyPressEvent().

    Look up this member in the source code.

    Toggle details void QTreeView

    keyboardSearchkeyboardSearch ( const QString &search ) ( const QString &search ) [virtual]

    Reimplemented from QAbstractItemView::keyboardSearch().

    Look up this member in the source code.

    Toggle details void QTreeView

    mouseDoubleClickEventmouseDoubleClickEvent ( QMouseEvent *event ) ( QMouseEvent *event ) [virtual protected]

    Reimplemented from QWidget::mouseDoubleClickEvent().

    Look up this member in the source code.

    Toggle details void QTreeView

    mouseMoveEventmouseMoveEvent ( QMouseEvent *event ) ( QMouseEvent *event ) [virtual protected]

    Reimplemented from QWidget::mouseMoveEvent().

    Look up this member in the source code.

    Toggle details void QTreeView

    mousePressEventmousePressEvent ( QMouseEvent *event ) ( QMouseEvent *event ) [virtual protected]

    Reimplemented from QWidget::mousePressEvent().

    Look up this member in the source code.

    Toggle details void QTreeView

    mouseReleaseEventmouseReleaseEvent ( QMouseEvent *event ) ( QMouseEvent *event ) [virtual protected]

    Reimplemented from QWidget::mouseReleaseEvent().

    Look up this member in the source code.

    Toggle details QModelIndex QTreeView

    moveCursormoveCursor ( CursorAction cursorAction , Qt::KeyboardModifiers modifiers ...) ( CursorAction cursorAction , Qt::KeyboardModifiers modifiers ) [virtual protected]

    Reimplemented from QAbstractItemView::moveCursor().

    Move the cursor in the way described by cursorAction, using the information provided by the button modifiers.

    Look up this member in the source code.

    Toggle details void QTreeView

    paintEventpaintEvent ( QPaintEvent *event ) ( QPaintEvent *event ) [virtual protected]

    Reimplemented from QWidget::paintEvent().

    Look up this member in the source code.

    Toggle details void QTreeView

    resetreset () () [virtual]

    Reimplemented from QAbstractItemView::reset().

    Look up this member in the source code.

    Toggle details int QTreeView

    rowHeightrowHeight ( const QModelIndex &index ) ( const QModelIndex &index )const[protected]

    Returns the height of the row indicated by the given index.

    See also indexRowSizeHint().

    Look up this member in the source code.

    Toggle details void QTreeView

    rowsAboutToBeRemovedrowsAboutToBeRemoved ( const QModelIndex &parent , int start , int end ...) ( const QModelIndex &parent , int start , int end ) [virtual protected]

    Reimplemented from QAbstractItemView::rowsAboutToBeRemoved().

    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.

    Look up this member in the source code.

    Toggle details void QTreeView

    rowsInsertedrowsInserted ( const QModelIndex &parent , int start , int end ...) ( const QModelIndex &parent , int start , int end ) [virtual protected]

    Reimplemented from QAbstractItemView::rowsInserted().

    Informs the view that the rows from the start row to the end row inclusive have been inserted into the parent model item.

    Look up this member in the source code.

    Toggle details void QTreeView

    scrollContentsByscrollContentsBy ( int dx , int dy ) ( int dx , int dy ) [virtual protected]

    Reimplemented from QAbstractScrollArea::scrollContentsBy().

    Scrolls the contents of the tree view by (dx, dy).

    Look up this member in the source code.

    Toggle details void QTreeView

    scrollToscrollTo ( const QModelIndex &index , ScrollHint hint=EnsureVisible ...) ( const QModelIndex &index , ScrollHint hint=EnsureVisible ) [virtual]

    Reimplemented from QAbstractItemView::scrollTo().

    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.

    Look up this member in the source code.

    Toggle details void QTreeView

    selectAllselectAll () () [virtual]

    Reimplemented from QAbstractItemView::selectAll().

    Look up this member in the source code.

    Toggle details QModelIndexList QTreeView

    selectedIndexesselectedIndexes () ()const [virtual protected]

    Reimplemented from QAbstractItemView::selectedIndexes().

    Look up this member in the source code.

    Toggle details void QTreeView

    selectionChangedselectionChanged ( const QItemSelection &selected , const QItemSelection &deselected ...) ( const QItemSelection &selected , const QItemSelection &deselected ) [virtual protected]

    Reimplemented from QAbstractItemView::selectionChanged().

    Look up this member in the source code.

    Toggle details void QTreeView

    setColumnHiddensetColumnHidden ( int column , bool hide ) ( int column , bool hide )

    If hide is true the column is hidden, otherwise the column is shown.

    See also isColumnHidden(), hideColumn(), and setRowHidden().

    Look up this member in the source code.

    Toggle details void QTreeView

    setColumnWidthsetColumnWidth ( int column , int width ) ( int column , int width )

    Sets the width of the given column to the width specified.

    See also columnWidth() and resizeColumnToContents().

    Look up this member in the source code.

    Toggle details void QTreeView

    setExpandedsetExpanded ( const QModelIndex &index , bool expanded ...) ( const QModelIndex &index , bool expanded )

    Sets the item referred to by index to either collapse or expanded, depending on the value of expanded.

    See also expanded(), expand(), and isExpanded().

    Look up this member in the source code.

    Toggle details void QTreeView

    setFirstColumnSpannedsetFirstColumnSpanned ( int row , const QModelIndex &parent , bool span ...) ( 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.

    See also isFirstColumnSpanned().

    Look up this member in the source code.

    Toggle details void QTreeView

    setHeadersetHeader ( QHeaderView *header ) ( 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.

    See also QAbstractItemModel::headerData().

    Look up this member in the source code.

    Toggle details void QTreeView

    setModelsetModel ( QAbstractItemModel *model ) ( QAbstractItemModel *model ) [virtual]

    Reimplemented from QAbstractItemView::setModel().

    Look up this member in the source code.

    Toggle details void QTreeView

    setRootIndexsetRootIndex ( const QModelIndex &index ) ( const QModelIndex &index ) [virtual]

    Reimplemented from QAbstractItemView::setRootIndex().

    Look up this member in the source code.

    Toggle details void QTreeView

    setRowHiddensetRowHidden ( int row , const QModelIndex &parent , bool hide ...) ( int row , const QModelIndex &parent , bool hide )

    If hide is true the row with the given parent is hidden, otherwise the row is shown.

    See also isRowHidden() and setColumnHidden().

    Look up this member in the source code.

    Toggle details void QTreeView

    setSelectionsetSelection ( const QRect &rect , QItemSelectionModel::SelectionFlags command ...) ( const QRect &rect , QItemSelectionModel::SelectionFlags command ) [virtual protected]

    Reimplemented from QAbstractItemView::setSelection().

    Applies the selection command to the items in or touched by the rectangle, rect.

    See also selectionCommand().

    Look up this member in the source code.

    Toggle details void QTreeView

    setSelectionModelsetSelectionModel ( QItemSelectionModel *selectionModel ...) ( QItemSelectionModel *selectionModel ) [virtual]

    Reimplemented from QAbstractItemView::setSelectionModel().

    Look up this member in the source code.

    Toggle details int QTreeView

    sizeHintForColumnsizeHintForColumn ( int column ) ( int column )const [virtual protected]

    Reimplemented from QAbstractItemView::sizeHintForColumn().

    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.

    See also QWidget::sizeHint and header().

    Look up this member in the source code.

    Toggle details void QTreeView

    sortByColumnsortByColumn ( int column , Qt::SortOrder order ( int column , Qt::SortOrder order )

    Sets the model up for sorting 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.

    See also sortingEnabled.

    Look up this member in the source code.

    Toggle details void QTreeView

    timerEventtimerEvent ( QTimerEvent *event ) ( QTimerEvent *event ) [virtual protected]

    Reimplemented from QObject::timerEvent().

    Look up this member in the source code.

    Toggle details void QTreeView

    updateGeometriesupdateGeometries () () [virtual protected]

    Reimplemented from QAbstractItemView::updateGeometries().

    Look up this member in the source code.

    Toggle details int QTreeView

    verticalOffsetverticalOffset () ()const [virtual protected]

    Reimplemented from QAbstractItemView::verticalOffset().

    Returns the vertical offset of the items in the tree view.

    See also horizontalOffset().

    Look up this member in the source code.

    Toggle details bool QTreeView

    viewportEventviewportEvent ( QEvent *event ) ( QEvent *event ) [virtual protected]

    Reimplemented from QAbstractScrollArea::viewportEvent().

    Look up this member in the source code.

    Toggle details QRect QTreeView

    visualRectvisualRect ( const QModelIndex &index ) ( const QModelIndex &index )const [virtual]

    Reimplemented from QAbstractItemView::visualRect().

    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.

    Look up this member in the source code.

    Toggle details QRegion QTreeView

    visualRegionForSelectionvisualRegionForSelection ( const QItemSelection &selection ...) ( const QItemSelection &selection )const [virtual protected]

    Reimplemented from QAbstractItemView::visualRegionForSelection().

    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.

    Look up this member in the source code.

    Signals

    Toggle details void QTreeView

    collapsedcollapsed ( const QModelIndex &index ) ( const QModelIndex &index ) [signal]

    This signal is emitted when the item specified by index is collapsed.

    Look up this member in the source code.

    Toggle details void QTreeView

    expandedexpanded ( const QModelIndex &index ) ( const QModelIndex &index ) [signal]

    This signal is emitted when the item specified by index is expanded.

    See also setExpanded().

    Look up this member in the source code.

    Public Slots

    Toggle details void QTreeView

    collapsecollapse ( const QModelIndex &index ) ( const QModelIndex &index ) [slot]

    Collapses the model item specified by the index.

    See also collapsed().

    Look up this member in the source code.

    Toggle details void QTreeView

    collapseAllcollapseAll () () [slot]

    Collapses all expanded items.

    See also expandAll(), expand(), collapse(), and setExpanded().

    Look up this member in the source code.

    Toggle details void QTreeView

    columnCountChangedcolumnCountChanged ( int oldCount , int newCount ...) ( int oldCount , int newCount )[protected] [slot]

    Informs the tree view that the number of columns in the tree view has changed from oldCount to newCount.

    Look up this member in the source code.

    Toggle details void QTreeView

    columnMovedcolumnMoved () ()[protected] [slot]

    This slot is called whenever a column has been moved.

    Look up this member in the source code.

    Toggle details void QTreeView

    columnResizedcolumnResized ( int column , int oldSize , int newSize ...) ( int column , int oldSize , int newSize )[protected] [slot]

    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.

    See also setColumnWidth().

    Look up this member in the source code.

    Toggle details void QTreeView

    expandexpand ( const QModelIndex &index ) ( const QModelIndex &index ) [slot]

    Expands the model item specified by the index.

    See also expanded().

    Look up this member in the source code.

    Toggle details void QTreeView

    expandAllexpandAll () () [slot]

    Expands all expandable items.

    Warning: if the model contains a large number of items, this function will take some time to execute.

    See also collapseAll(), expand(), collapse(), and setExpanded().

    Look up this member in the source code.

    Toggle details void QTreeView

    expandToDepthexpandToDepth ( int depth ) ( int depth ) [slot]

    Expands all expandable items to the given depth.

    See also expandAll(), collapseAll(), expand(), collapse(), and setExpanded().

    Look up this member in the source code.

    Toggle details void QTreeView

    hideColumnhideColumn ( int column ) ( int column ) [slot]

    Hides the column given.

    Note: This function should only be called after the model has been initialized, as the view needs to know the number of columns in order to hide column.

    See also showColumn() and setColumnHidden().

    Look up this member in the source code.

    Toggle details void QTreeView

    resizeColumnToContentsresizeColumnToContents ( int column ) ( int column ) [slot]

    Resizes the column given to the size of its contents.

    See also columnWidth() and setColumnWidth().

    Look up this member in the source code.

    Toggle details void QTreeView

    rowsRemovedrowsRemoved ( const QModelIndex &parent , int start , int end ...) ( const QModelIndex &parent , int start , int end )[protected] [slot]

    Informs the view that the rows from the start row to the end row inclusive have been removed from the given parent model item.

    Look up this member in the source code.

    Toggle details void QTreeView

    showColumnshowColumn ( int column ) ( int column ) [slot]

    Shows the given column in the tree view.

    See also hideColumn() and setColumnHidden().

    Look up this member in the source code.

    Toggle details void QTreeView

    sortByColumnsortByColumn ( int column ) ( int column ) [slot] Obsolete function

    This is an overloaded function.

    Sorts the model by the values in the given column.

    Look up this member in the source code.

    Notes provided by the Qt Community

    No notes