QTreeView class provides a default model/view implementation of a tree view. 更多...
头: | #include <QTreeView> |
qmake: | QT += widgets |
继承: | QAbstractItemView |
继承者: |
|
|
QTreeView (QWidget * parent = Q_NULLPTR) | |
~QTreeView () | |
bool | allColumnsShowFocus () const |
int | autoExpandDelay () const |
int | columnAt (int x ) const |
int | columnViewportPosition (int column ) const |
int | columnWidth (int column ) const |
bool | expandsOnDoubleClick () const |
QHeaderView * | header () const |
int | indentation () const |
QModelIndex | indexAbove (const QModelIndex & index ) const |
QModelIndex | indexBelow (const QModelIndex & index ) const |
bool | isAnimated () const |
bool | isColumnHidden (int column ) const |
bool | isExpanded (const QModelIndex & index ) const |
bool | isFirstColumnSpanned (int row , const QModelIndex & parent ) const |
bool | isHeaderHidden () const |
bool | isRowHidden (int row , const QModelIndex & parent ) const |
bool | isSortingEnabled () const |
bool | itemsExpandable () const |
void | resetIndentation () |
bool | rootIsDecorated () const |
void | setAllColumnsShowFocus (bool enable ) |
void | setAnimated (bool enable ) |
void | setAutoExpandDelay (int delay ) |
void | setColumnHidden (int column , bool hide ) |
void | setColumnWidth (int column , int width ) |
void | setExpanded (const QModelIndex & index , bool expanded ) |
void | setExpandsOnDoubleClick (bool enable ) |
void | setFirstColumnSpanned (int row , const QModelIndex & parent , bool span ) |
void | setHeader (QHeaderView * header ) |
void | setHeaderHidden (bool hide ) |
void | setIndentation (int i ) |
void | setItemsExpandable (bool enable ) |
void | setRootIsDecorated (bool show ) |
void | setRowHidden (int row , const QModelIndex & parent , bool hide ) |
void | setSortingEnabled (bool enable ) |
void | setTreePosition (int index ) |
void | setUniformRowHeights (bool uniform ) |
void | setWordWrap (bool on ) |
void | sortByColumn (int column , Qt::SortOrder order ) |
int | treePosition () const |
bool | uniformRowHeights () const |
bool | wordWrap () const |
virtual void | dataChanged (const QModelIndex & topLeft , const QModelIndex & bottomRight , const QVector<int> & roles = QVector<int> ()) |
virtual QModelIndex | indexAt (const QPoint & point ) const |
virtual void | keyboardSearch (const QString & search ) |
virtual void | reset () |
virtual void | scrollTo (const QModelIndex & index , ScrollHint hint = EnsureVisible) |
virtual void | selectAll () |
virtual void | setModel (QAbstractItemModel * model ) |
virtual void | setRootIndex (const QModelIndex & index ) |
virtual void | setSelectionModel (QItemSelectionModel * selectionModel ) |
virtual QRect | visualRect (const QModelIndex & index ) const |
void | collapse (const QModelIndex & index ) |
void | collapseAll () |
void | expand (const QModelIndex & index ) |
void | expandAll () |
void | expandToDepth (int depth ) |
void | hideColumn (int column ) |
void | resizeColumnToContents (int column ) |
void | showColumn (int column ) |
void | collapsed (const QModelIndex & index ) |
void | expanded (const QModelIndex & index ) |
virtual void | drawBranches (QPainter * painter , const QRect & rect , const QModelIndex & index ) const |
virtual void | drawRow (QPainter * painter , const QStyleOptionViewItem & option , const QModelIndex & index ) const |
void | drawTree (QPainter * painter , const QRegion & region ) const |
int | indexRowSizeHint (const QModelIndex & index ) const |
int | rowHeight (const QModelIndex & index ) const |
virtual void | currentChanged (const QModelIndex & current , const QModelIndex & previous ) |
virtual void | dragMoveEvent (QDragMoveEvent * event ) |
virtual int | horizontalOffset () const |
virtual bool | isIndexHidden (const QModelIndex & index ) const |
virtual void | keyPressEvent (QKeyEvent * event ) |
virtual void | mouseDoubleClickEvent (QMouseEvent * event ) |
virtual void | mouseMoveEvent (QMouseEvent * event ) |
virtual void | mousePressEvent (QMouseEvent * event ) |
virtual void | mouseReleaseEvent (QMouseEvent * event ) |
virtual QModelIndex | moveCursor (CursorAction cursorAction , Qt::KeyboardModifiers modifiers ) |
virtual void | paintEvent (QPaintEvent * event ) |
virtual void | rowsAboutToBeRemoved (const QModelIndex & parent , int start , int end ) |
virtual void | rowsInserted (const QModelIndex & parent , int start , int end ) |
virtual void | scrollContentsBy (int dx , int dy ) |
virtual QModelIndexList | selectedIndexes () const |
virtual void | selectionChanged (const QItemSelection & selected , const QItemSelection & deselected ) |
virtual void | setSelection (const QRect & rect , QItemSelectionModel::SelectionFlags command ) |
virtual int | sizeHintForColumn (int column ) const |
virtual void | timerEvent (QTimerEvent * event ) |
virtual void | updateGeometries () |
virtual int | verticalOffset () const |
virtual bool | viewportEvent (QEvent * event ) |
virtual QSize | viewportSizeHint () const |
virtual QRegion | visualRegionForSelection (const QItemSelection & selection ) const |
void | columnCountChanged (int oldCount , int newCount ) |
void | columnMoved () |
void | columnResized (int column , int oldSize , int newSize ) |
void | rowsRemoved (const QModelIndex & parent , int start , int end ) |
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
类,但使用由 Qt 模型/视图体系结构提供的方式更灵活。
QTreeView 类是一种 模型/视图类 且属于 Qt 的 模型/视图框架 .
QTreeView implements the interfaces defined by the QAbstractItemView 类以允许它显示提供数据,通过模型派生自 QAbstractItemModel 类。
构建树视图以显示来自模型的数据很简单。在以下范例中,目录内容的提供通过 QFileSystemModel 并作为树显示:
QFileSystemModel *model = new QFileSystemModel; model->setRootPath(QDir::currentPath()); QTreeView *tree = new QTreeView(splitter); tree->setModel(model);
模型/视图体系结构确保树视图内容随模型改变更新。
拥有子级的项可以处于展开 (子级可见) 或折叠 (子级被隐藏) 状态。当此状态改变 collapsed () 或 expanded () 信号被发射带有相关项模型索引。
用于指示层次结构级别缩进量的控制通过 indentation 特性。
树视图 Header 头部的构造使用
QHeaderView
类且可以被隐藏使用
header()->hide()
。注意,每个 Header 头部的配置采用其
stretchLastSection
特性被设为 true,确保视图不浪费为 Header 头部赋值的任何空间。若此值被设为 true,此特性将覆盖 Header 头部最后区间设置的重置尺寸模式。
默认情况下,树视图的所有列是可移动的,除第一列外。要禁用这些列的移动,使用 QHeaderView 's setSectionsMovable() 函数。有关重新排列区间的更多信息,见 移动 Header 头区间 .
QTreeView supports a set of key bindings that enable the user to navigate in the view and interact with the contents of items:
Key | 动作 |
---|---|
Up | 将光标移动到上一行相同列项。若当前项父级没有更多行可导航,光标将移动到父级之前最后同级行相关项。 |
Down | Moves 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. |
Left | 通过折叠分支隐藏当前项 (若存在) 子级。 |
Minus | Same as LeftArrow. |
Right | 通过展开分支展现当前项 (若存在) 子级。 |
Plus | Same as RightArrow. |
星号 | Expands all children of the current item (if present). |
PageUp | 上移光标一页。 |
PageDown | 下移光标一页。 |
首页 | Moves the cursor to an item in the same column of the first row of the first top-level item in the model. |
End | Moves the cursor to an item in the same column of the last row of the last top-level item in the model. |
F2 | In 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. |
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 特性到 true。
另请参阅 QListView , QTreeWidget , 视图类 , QAbstractItemModel , QAbstractItemView ,和 目录视图范例 .
此特性保持项是否应使用所有列展示键盘聚焦
若此特性为
true
所有列将展示焦点,否则仅一列将展示焦点。
默认为 false。
该特性在 Qt 4.2 引入。
访问函数:
bool | allColumnsShowFocus () const |
void | setAllColumnsShowFocus (bool enable ) |
此特性保持是否启用动画
若此特性为
true
树视图将动画分支的扩展和折叠。若此特性为
false
, the treeview will expand or collapse branches immediately without showing the animation.
默认情况下此特性为
false
.
该特性在 Qt 4.2 引入。
访问函数:
bool | isAnimated () const |
void | setAnimated (bool enable ) |
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.
该特性在 Qt 4.3 引入。
访问函数:
int | autoExpandDelay () const |
void | setAutoExpandDelay (int delay ) |
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.
该特性在 Qt 4.4 引入。
访问函数:
bool | expandsOnDoubleClick () const |
void | setExpandsOnDoubleClick (bool enable ) |
另请参阅 itemsExpandable .
This property holds whether the header is shown or not.
若此特性为
true
, the header is not shown otherwise it is. The default value is false.
该特性在 Qt 4.4 引入。
访问函数:
bool | isHeaderHidden () const |
void | setHeaderHidden (bool hide ) |
另请参阅 header ().
树视图中项的缩进。
此特性保持树视图每级项的缩进度量 (以像素为单位)。对于顶层项,缩进指定从视口边缘到第一列项的水平距离;对于子级项,它指定其父项的缩进。
默认情况下,此特性的值从属样式。因此,当样式改变时,此特性随之更新。调用 setIndentation() 停止更新,调用 resetIndentation() 将还原默认行为。
访问函数:
int | indentation () const |
void | setIndentation (int i ) |
void | resetIndentation () |
此特性保持项是否可以由用户展开。
此特性保持用户是否可以交互展开和折叠项。
默认情况下此特性为
true
.
访问函数:
bool | itemsExpandable () const |
void | setItemsExpandable (bool enable ) |
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.
默认情况下此特性为
true
.
访问函数:
bool | rootIsDecorated () const |
void | setRootIsDecorated (bool show ) |
此特性保持是否启用排序
若此特性为
true
, sorting is enabled for the tree; if the property is false, sorting is not enabled. The default value is false.
注意: 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.
该特性在 Qt 4.2 引入。
访问函数:
bool | isSortingEnabled () const |
void | setSortingEnabled (bool enable ) |
另请参阅 sortByColumn ().
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.
注意: If the editor size hint is bigger than the cell size hint, then the size hint of the editor will be used.
默认情况下此特性为
false
.
访问函数:
bool | uniformRowHeights () const |
void | setUniformRowHeights (bool uniform ) |
此特性保持项文本的自动换行策略
若此特性为
true
then the item text is wrapped where necessary at word-breaks; otherwise it is not wrapped at all. This property is
false
在默认情况下。
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 .
该特性在 Qt 4.3 引入。
访问函数:
bool | wordWrap () const |
void | setWordWrap (bool on ) |
构造树视图采用 parent 来表示模型数据。使用 setModel () 来设置模型。
另请参阅 QAbstractItemModel .
销毁树视图。
[slot]
void
QTreeView::
collapse
(const
QModelIndex
&
index
)
折叠的模型项指定通过 index .
另请参阅 collapsed ().
[slot]
void
QTreeView::
collapseAll
()
折叠所有展开项。
该函数在 Qt 4.2 引入。
另请参阅 expandAll (), expand (), collapse (),和 setExpanded ().
[signal]
void
QTreeView::
collapsed
(const
QModelIndex
&
index
)
此信号被发射当项指定通过 index is collapsed.
Returns the column in the tree view whose header covers the x coordinate given.
[protected slot]
void
QTreeView::
columnCountChanged
(
int
oldCount
,
int
newCount
)
Informs the tree view that the number of columns in the tree view has changed from oldCount to newCount .
[protected slot]
void
QTreeView::
columnMoved
()
This slot is called whenever a column has been moved.
[protected slot]
void
QTreeView::
columnResized
(
int
column
,
int
oldSize
,
int
newSize
)
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.
另请参阅 setColumnWidth ().
Returns the horizontal position of the column in the viewport.
返回宽度为 column .
另请参阅 resizeColumnToContents () 和 setColumnWidth ().
[virtual protected]
void
QTreeView::
currentChanged
(const
QModelIndex
&
current
, const
QModelIndex
&
previous
)
重实现自 QAbstractItemView::currentChanged ().
[virtual]
void
QTreeView::
dataChanged
(const
QModelIndex
&
topLeft
, const
QModelIndex
&
bottomRight
, const
QVector
<
int
> &
roles
= QVector<int> ())
重实现自 QAbstractItemView::dataChanged ().
[virtual protected]
void
QTreeView::
dragMoveEvent
(
QDragMoveEvent
*
event
)
重实现自 QWidget::dragMoveEvent ().
[virtual protected]
void
QTreeView::
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 ,使用 painter given. The branches are drawn in the rectangle specified by rect .
[virtual protected]
void
QTreeView::
drawRow
(
QPainter
*
painter
, const
QStyleOptionViewItem
&
option
, const
QModelIndex
&
index
) const
Draws the row in the tree view that contains the model item index ,使用 painter given. The option controls how the item is displayed.
另请参阅 setAlternatingRowColors ().
[protected]
void
QTreeView::
drawTree
(
QPainter
*
painter
, const
QRegion
&
region
) const
Draws the part of the tree intersecting the given region 使用指定 painter .
该函数在 Qt 4.2 引入。
另请参阅 paintEvent ().
[slot]
void
QTreeView::
expand
(const
QModelIndex
&
index
)
Expands the model item specified by the index .
另请参阅 expanded ().
[slot]
void
QTreeView::
expandAll
()
展开所有可展开项。
Warning: if the model contains a large number of items, this function will take some time to execute.
该函数在 Qt 4.2 引入。
另请参阅 collapseAll (), expand (), collapse (),和 setExpanded ().
[slot]
void
QTreeView::
expandToDepth
(
int
depth
)
展开所有可展开项到给定 depth .
该函数在 Qt 4.3 引入。
另请参阅 expandAll (), collapseAll (), expand (), collapse (),和 setExpanded ().
[signal]
void
QTreeView::
expanded
(const
QModelIndex
&
index
)
此信号被发射当项指定通过 index is expanded.
另请参阅 setExpanded ().
返回用于树视图的 Header 头。
另请参阅 setHeader () 和 QAbstractItemModel::headerData ().
[slot]
void
QTreeView::
hideColumn
(
int
column
)
隐藏 column 给定。
注意: 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 .
另请参阅 showColumn () 和 setColumnHidden ().
[virtual protected]
int
QTreeView::
horizontalOffset
() const
重实现自 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.
另请参阅 verticalOffset ().
Returns the model index of the item above index .
[virtual]
QModelIndex
QTreeView::
indexAt
(const
QPoint
&
point
) const
重实现自 QAbstractItemView::indexAt ().
Returns the model index of the item below index .
[protected]
int
QTreeView::
indexRowSizeHint
(const
QModelIndex
&
index
) const
Returns the size hint for the row indicated by index .
另请参阅 sizeHintForColumn () 和 uniformRowHeights ().
返回
true
若
column
被隐藏;否则返回
false
.
另请参阅 hideColumn () 和 isRowHidden ().
返回
true
若模型项
index
被展开;否则返回 false。
另请参阅 expand (), expanded (),和 setExpanded ().
返回
true
若第一列中的项在给定
row
的
parent
跨越所有列;否则返回
false
.
该函数在 Qt 4.3 引入。
另请参阅 setFirstColumnSpanned ().
[virtual protected]
bool
QTreeView::
isIndexHidden
(const
QModelIndex
&
index
) const
重实现自 QAbstractItemView::isIndexHidden ().
返回
true
若项在给定
row
的
parent
被隐藏;否则返回
false
.
另请参阅 setRowHidden () 和 isColumnHidden ().
[virtual protected]
void
QTreeView::
keyPressEvent
(
QKeyEvent
*
event
)
重实现自 QWidget::keyPressEvent ().
[virtual]
void
QTreeView::
keyboardSearch
(const
QString
&
search
)
重实现自 QAbstractItemView::keyboardSearch ().
[virtual protected]
void
QTreeView::
mouseDoubleClickEvent
(
QMouseEvent
*
event
)
重实现自 QWidget::mouseDoubleClickEvent ().
[virtual protected]
void
QTreeView::
mouseMoveEvent
(
QMouseEvent
*
event
)
重实现自 QWidget::mouseMoveEvent ().
[virtual protected]
void
QTreeView::
mousePressEvent
(
QMouseEvent
*
event
)
重实现自 QWidget::mousePressEvent ().
[virtual protected]
void
QTreeView::
mouseReleaseEvent
(
QMouseEvent
*
event
)
重实现自 QWidget::mouseReleaseEvent ().
[virtual protected]
QModelIndex
QTreeView::
moveCursor
(
CursorAction
cursorAction
,
Qt::KeyboardModifiers
modifiers
)
重实现自 QAbstractItemView::moveCursor ().
Move the cursor in the way described by cursorAction , using the information provided by the button modifiers .
[virtual protected]
void
QTreeView::
paintEvent
(
QPaintEvent
*
event
)
重实现自 QWidget::paintEvent ().
[virtual]
void
QTreeView::
reset
()
重实现自 QAbstractItemView::reset ().
[slot]
void
QTreeView::
resizeColumnToContents
(
int
column
)
重置大小 column given to the size of its contents.
另请参阅 columnWidth (), setColumnWidth (), sizeHintForColumn (),和 QHeaderView::resizeContentsPrecision ().
[protected]
int
QTreeView::
rowHeight
(const
QModelIndex
&
index
) const
返回指示行的高度通过给定 index .
该函数在 Qt 4.3 引入。
另请参阅 indexRowSizeHint ().
[virtual protected]
void
QTreeView::
rowsAboutToBeRemoved
(const
QModelIndex
&
parent
,
int
start
,
int
end
)
重实现自 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.
[virtual protected]
void
QTreeView::
rowsInserted
(const
QModelIndex
&
parent
,
int
start
,
int
end
)
重实现自 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.
[protected slot]
void
QTreeView::
rowsRemoved
(const
QModelIndex
&
parent
,
int
start
,
int
end
)
Informs the view that the rows from the start row to the end row inclusive have been removed from the given parent model item.
该函数在 Qt 4.1 引入。
[virtual protected]
void
QTreeView::
scrollContentsBy
(
int
dx
,
int
dy
)
重实现自 QAbstractScrollArea::scrollContentsBy ().
卷动树视图内容通过 ( dx , dy ).
[virtual]
void
QTreeView::
scrollTo
(const
QModelIndex
&
index
,
ScrollHint
hint
= EnsureVisible)
重实现自 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.
[virtual]
void
QTreeView::
selectAll
()
重实现自 QAbstractItemView::selectAll ().
[virtual protected]
QModelIndexList
QTreeView::
selectedIndexes
() const
重实现自 QAbstractItemView::selectedIndexes ().
[virtual protected]
void
QTreeView::
selectionChanged
(const
QItemSelection
&
selected
, const
QItemSelection
&
deselected
)
重实现自 QAbstractItemView::selectionChanged ().
若 hide 为 true column 被隐藏,否则 column 被展示。
另请参阅 isColumnHidden (), hideColumn (),和 setRowHidden ().
设置宽度为给定 column 到 width 指定。
该函数在 Qt 4.2 引入。
另请参阅 columnWidth () 和 resizeColumnToContents ().
Sets the item referred to by index to either collapse or expanded, depending on the value of expanded .
另请参阅 expanded (), expand (),和 isExpanded ().
若 span is true the item in the first column in the row 采用给定 parent is set to span all columns, otherwise all items on the row are shown.
该函数在 Qt 4.3 引入。
另请参阅 isFirstColumnSpanned ().
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.
另请参阅 QAbstractItemModel::headerData ().
[virtual]
void
QTreeView::
setModel
(
QAbstractItemModel
*
model
)
重实现自 QAbstractItemView::setModel ().
[virtual]
void
QTreeView::
setRootIndex
(const
QModelIndex
&
index
)
重实现自 QAbstractItemView::setRootIndex ().
若 hide 为 true row 采用给定 parent 被隐藏,否则 row 被展示。
另请参阅 isRowHidden () 和 setColumnHidden ().
[virtual protected]
void
QTreeView::
setSelection
(const
QRect
&
rect
,
QItemSelectionModel::SelectionFlags
command
)
重实现自 QAbstractItemView::setSelection ().
Applies the selection command to the items in or touched by the rectangle, rect .
另请参阅 selectionCommand ().
[virtual]
void
QTreeView::
setSelectionModel
(
QItemSelectionModel
*
selectionModel
)
重实现自 QAbstractItemView::setSelectionModel ().
这指定树结构应放置在逻辑索引 index 。若 设为 -1 则树始终紧跟视觉索引 0。
该函数在 Qt 5.2 引入。
另请参阅 treePosition (), QHeaderView::swapSections (),和 QHeaderView::moveSection ().
[slot]
void
QTreeView::
showColumn
(
int
column
)
展示给定 column 在树视图。
另请参阅 hideColumn () 和 setColumnHidden ().
[virtual protected]
int
QTreeView::
sizeHintForColumn
(
int
column
) const
重实现自 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.
另请参阅 QWidget::sizeHint , header (),和 QHeaderView::resizeContentsPrecision ().
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.
该函数在 Qt 4.2 引入。
另请参阅 sortingEnabled .
[virtual protected]
void
QTreeView::
timerEvent
(
QTimerEvent
*
event
)
重实现自 QObject::timerEvent ().
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.
该函数在 Qt 5.2 引入。
另请参阅 setTreePosition ().
[virtual protected]
void
QTreeView::
updateGeometries
()
重实现自 QAbstractItemView::updateGeometries ().
[virtual protected]
int
QTreeView::
verticalOffset
() const
重实现自 QAbstractItemView::verticalOffset ().
返回树视图中项的垂直偏移。
另请参阅 horizontalOffset ().
[virtual protected]
bool
QTreeView::
viewportEvent
(
QEvent
*
event
)
重实现自 QAbstractScrollArea::viewportEvent ().
[virtual protected]
QSize
QTreeView::
viewportSizeHint
() const
重实现自 QAbstractScrollArea::viewportSizeHint ().
[virtual]
QRect
QTreeView::
visualRect
(const
QModelIndex
&
index
) const
重实现自 QAbstractItemView::visualRect ().
返回项所占据的视口矩形为 index 。若索引不可见或被明确隐藏,返回矩形无效。
[virtual protected]
QRegion
QTreeView::
visualRegionForSelection
(const
QItemSelection
&
selection
) const
重实现自 QAbstractItemView::visualRegionForSelection ().
返回矩形从项视口在给定 selection .
从 4.7 起,返回区域仅包含 (或包括在) 视口相交矩形。