The QHeaderView 類為項視圖提供 Header 頭部行 (或 Header 頭部列)。 更多...
| 頭: | #include <QHeaderView> |
| 繼承: | QAbstractItemView |
| enum | ResizeMode { Interactive, Fixed, Stretch, ResizeToContents, Custom } |
|
|
| QHeaderView (Qt::Orientation orientation , QWidget * parent = 0) | |
| virtual | ~QHeaderView () |
| bool | cascadingSectionResizes () const |
| int | count () const |
| Qt::Alignment | defaultAlignment () const |
| int | defaultSectionSize () const |
| int | hiddenSectionCount () const |
| void | hideSection (int logicalIndex ) |
| bool | highlightSections () const |
| bool | isClickable () const |
| bool | isMovable () const |
| bool | isSectionHidden (int logicalIndex ) const |
| bool | isSortIndicatorShown () const |
| int | length () const |
| int | logicalIndex (int visualIndex ) const |
| int | logicalIndexAt (int position ) const |
| int | logicalIndexAt (int x , int y ) const |
| int | logicalIndexAt (const QPoint & pos ) const |
| int | minimumSectionSize () const |
| void | moveSection (int from , int to ) |
| int | offset () const |
| Qt::Orientation | orientation () const |
| ResizeMode | resizeMode (int logicalIndex ) const |
| void | resizeSection (int logicalIndex , int size ) |
| void | resizeSections (QHeaderView::ResizeMode mode ) |
| bool | restoreState (const QByteArray & state ) |
| QByteArray | saveState () const |
| int | sectionPosition (int logicalIndex ) const |
| int | sectionSize (int logicalIndex ) const |
| int | sectionSizeHint (int logicalIndex ) const |
| int | sectionViewportPosition (int logicalIndex ) const |
| bool | sectionsHidden () const |
| bool | sectionsMoved () const |
| void | setCascadingSectionResizes (bool enable ) |
| void | setClickable (bool clickable ) |
| void | setDefaultAlignment (Qt::Alignment alignment ) |
| void | setDefaultSectionSize (int size ) |
| void | setHighlightSections (bool highlight ) |
| void | setMinimumSectionSize (int size ) |
| void | setMovable (bool movable ) |
| void | setResizeMode (ResizeMode mode ) |
| void | setResizeMode (int logicalIndex , ResizeMode mode ) |
| void | setSectionHidden (int logicalIndex , bool hide ) |
| void | setSortIndicator (int logicalIndex , Qt::SortOrder order ) |
| void | setSortIndicatorShown (bool show ) |
| void | setStretchLastSection (bool stretch ) |
| void | showSection (int logicalIndex ) |
| Qt::SortOrder | sortIndicatorOrder () const |
| int | sortIndicatorSection () const |
| bool | stretchLastSection () const |
| int | stretchSectionCount () const |
| void | swapSections (int first , int second ) |
| int | visualIndex (int logicalIndex ) const |
| int | visualIndexAt (int position ) const |
| virtual void | reset () |
| virtual void | setModel (QAbstractItemModel * model ) |
| virtual QSize | sizeHint () const |
| void | headerDataChanged (Qt::Orientation orientation , int logicalFirst , int logicalLast ) |
| void | setOffset (int offset ) |
| void | setOffsetToLastSection () |
| void | setOffsetToSectionPosition (int visualIndex ) |
| void | geometriesChanged () |
| void | sectionAutoResize (int logicalIndex , QHeaderView::ResizeMode mode ) |
| void | sectionClicked (int logicalIndex ) |
| void | sectionCountChanged (int oldCount , int newCount ) |
| void | sectionDoubleClicked (int logicalIndex ) |
| void | sectionEntered (int logicalIndex ) |
| void | sectionHandleDoubleClicked (int logicalIndex ) |
| void | sectionMoved (int logicalIndex , int oldVisualIndex , int newVisualIndex ) |
| void | sectionPressed (int logicalIndex ) |
| void | sectionResized (int logicalIndex , int oldSize , int newSize ) |
| void | sortIndicatorChanged (int logicalIndex , Qt::SortOrder order ) |
| void | initStyleOption (QStyleOptionHeader * option ) const |
| virtual void | paintSection (QPainter * painter , const QRect & rect , int logicalIndex ) const |
| virtual QSize | sectionSizeFromContents (int logicalIndex ) const |
| virtual void | currentChanged (const QModelIndex & current , const QModelIndex & old ) |
| virtual bool | event (QEvent * e ) |
| virtual int | horizontalOffset () const |
| virtual void | mouseDoubleClickEvent (QMouseEvent * e ) |
| virtual void | mouseMoveEvent (QMouseEvent * e ) |
| virtual void | mousePressEvent (QMouseEvent * e ) |
| virtual void | mouseReleaseEvent (QMouseEvent * e ) |
| virtual void | paintEvent (QPaintEvent * e ) |
| virtual void | setSelection (const QRect & rect , QItemSelectionModel::SelectionFlags flags ) |
| virtual int | verticalOffset () const |
| virtual bool | viewportEvent (QEvent * e ) |
| void | resizeSections () |
| void | sectionsAboutToBeRemoved (const QModelIndex & parent , int logicalFirst , int logicalLast ) |
| void | sectionsInserted (const QModelIndex & parent , int logicalFirst , int logicalLast ) |
The QHeaderView 類為項視圖提供 Header 頭部行 (或 Header 頭部列)。
A
QHeaderView
顯示用於項視圖的 Header 頭部,譬如
QTableView
and
QTreeView
類。它取代 Qt3 的
QHeader
類以前用於相同目的,但根據項視圖類使用 Qt 的模型/視圖體係結構。
The QHeaderView 類是一種 模型/視圖類 且屬於 Qt 的 模型/視圖框架 .
頭從模型獲取每區間數據使用 QAbstractItemModel::headerData () 函數。可以設置數據通過使用 QAbstractItemModel::setHeaderData ().
每個頭有 orientation () 和許多區間,給定通過 count () 函數。區間引用頭的一部分 - 行或列取決於取嚮。
區間可以移動和重置大小使用 moveSection () 和 resizeSection ();它們還可以被隱藏和展示采用 hideSection () 和 showSection ().
頭的每區間由區間 ID 描述,指定通過其 section(),且可以位於特定 visualIndex () 在頭中。區間可以有排序指示器設置采用 setSortIndicator ();這指示關聯項視圖中的項是否將按區間給齣的次序進行排序。
對於水平頭,區間相當於模型列,對於垂直頭,區間相當於模型行。
頭位置可以固定,或使之可移動采用 setMovable ()。可以使之可點擊采用 setClickable (),和擁有重置大小行為根據 setResizeMode ().
注意: 雙擊頭調整區間尺寸僅適用於可見行。
Header (頭) 將發射 sectionMoved () 若用戶移動區間, sectionResized () 若用戶調整區間尺寸,和 sectionClicked () 及 sectionHandleDoubleClicked () 響應鼠標點擊。頭還會發射 sectionCountChanged () 和 sectionAutoResize ().
可以標識區間使用 logicalIndex () 和 logicalIndexAt () 函數,或通過其索引位置,使用 visualIndex () 和 visualIndexAt () 函數。視覺索引會改變若區間被移動,但邏輯索引不會改變。
QTableWidget and QTableView 創建默認 Header (頭部)。若希望 Header (頭部) 可見,可以使用 setVisible() .
並非所有 ItemDataRole s will have an effect on a QHeaderView . If you need to draw other roles, you can subclass QHeaderView 並重實現 paintEvent() . QHeaderView respects the following item data roles: TextAlignmentRole , DisplayRole , FontRole , DecorationRole , ForegroundRole ,和 BackgroundRole .
注意: 每個頭為每區間本身渲染數據,且不依賴委托。因此,調用頭的 setItemDelegate () 函數不起作用。
另請參閱 模型/視圖編程 , QListView , QTableView ,和 QTreeView .
重置尺寸模式指定頭區間的行為。可以被設置在整個頭視圖或單個區間使用 setResizeMode ().
| 常量 | 值 | 描述 |
|---|---|---|
QHeaderView::Interactive
|
0
|
用戶可以調整區間大小。也可以按編程方式調整區間大小使用 resizeSection ()。區間尺寸默認為 defaultSectionSize 。(另請參閱 cascadingSectionResizes )。 |
QHeaderView::Fixed
|
2
|
用戶無法調整區間大小。隻可以按編程方式調整區間大小使用 resizeSection ()。區間尺寸默認為 defaultSectionSize . |
QHeaderView::Stretch
|
1
|
QHeaderView 會自動重置區間大小以填充可用空間。用戶 (或以編程方式) 無法改變大小。 |
QHeaderView::ResizeToContents
|
3
|
QHeaderView 將基於整列 (或整行) 內容自動把區間尺寸調整到最優大小。尺寸無法被改變由用戶或按編程方式。(該值在 4.2 引入) |
以下值已過時:
| 常量 | 值 | 描述 |
|---|---|---|
QHeaderView::Custom
|
Fixed
|
使用 Fixed 代替。 |
另請參閱 setResizeMode (), stretchLastSection ,和 minimumSectionSize .
This property holds whether interactive resizing will be cascaded to the following sections once the section being resized by the user has reached its minimum size.
此特性隻影響區間擁有 Interactive 作為其重置尺寸模式。
默認值為 false。
該特性在 Qt 4.2 引入。
訪問函數:
| bool | cascadingSectionResizes () const |
| void | setCascadingSectionResizes (bool enable ) |
另請參閱 setResizeMode ().
This property holds the default alignment of the text in each header section.
該特性在 Qt 4.1 引入。
訪問函數:
| Qt::Alignment | defaultAlignment () const |
| void | setDefaultAlignment (Qt::Alignment alignment ) |
此特性保持頭部區間的默認大小,在重置大小前。
此特性隻影響區間擁有 Interactive or Fixed 作為其重置尺寸模式。
訪問函數:
| int | defaultSectionSize () const |
| void | setDefaultSectionSize (int size ) |
另請參閱 setResizeMode () 和 minimumSectionSize .
This property holds whether the sections containing selected items are highlighted.
默認情況下,此特性為 false。
訪問函數:
| bool | highlightSections () const |
| void | setHighlightSections (bool highlight ) |
此特性保持頭區間的最小尺寸。
最小區間尺寸是允許的最小區間尺寸。若最小區間尺寸被設為 -1, QHeaderView 將使用最大的 全局結構 或 字體規格 尺寸。
此特性被承兌由所有 重置大小模式 .
該特性在 Qt 4.2 引入。
訪問函數:
| int | minimumSectionSize () const |
| void | setMinimumSectionSize (int size ) |
另請參閱 setResizeMode () 和 defaultSectionSize .
This property holds whether the sort indicator is shown.
默認情況下,此特性為 false。
訪問函數:
| bool | isSortIndicatorShown () const |
| void | setSortIndicatorShown (bool show ) |
另請參閱 setClickable ().
This property holds whether the last visible section in the header takes up all the available space.
默認值為 false。
注意: 水平頭提供由 QTreeView 此特性配置被設為 true,確保視圖不浪費為其 Header (頭部) 賦值的任何空間。若此值被設為 true,此特性將覆蓋 Header (頭部) 最後區間設置的重置大小模式。
訪問函數:
| bool | stretchLastSection () const |
| void | setStretchLastSection (bool stretch ) |
另請參閱 setResizeMode ().
創建新通用頭采用給定 orientation and parent .
[虛擬]
QHeaderView::
~QHeaderView
()
銷毀 Header (頭)。
返迴 Header (頭) 中的區間數。
另請參閱 sectionCountChanged () 和 length ().
[virtual protected]
void
QHeaderView::
currentChanged
(const
QModelIndex
&
current
, const
QModelIndex
&
old
)
重實現自 QAbstractItemView::currentChanged ().
[virtual protected]
bool
QHeaderView::
event
(
QEvent
*
e
)
重實現自 QObject::event ().
[signal]
void
QHeaderView::
geometriesChanged
()
此信號被發射當頭幾何體有改變時。
該函數在 Qt 4.2 引入。
[slot]
void
QHeaderView::
headerDataChanged
(
Qt::Orientation
orientation
,
int
logicalFirst
,
int
logicalLast
)
更新改變頭區間采用給定 orientation ,從 logicalFirst to logicalLast 包括在內。
返迴已隱藏的頭區間數。
該函數在 Qt 4.1 引入。
另請參閱 setSectionHidden () 和 isSectionHidden ().
隱藏區間指定通過 logicalIndex .
另請參閱 showSection (), isSectionHidden (), hiddenSectionCount (),和 setSectionHidden ().
[virtual protected]
int
QHeaderView::
horizontalOffset
() const
重實現自 QAbstractItemView::horizontalOffset ().
返迴 Header (頭部) 的水平偏移。這為 0 對於垂直頭部。
另請參閱 offset ().
[protected]
void
QHeaderView::
initStyleOption
(
QStyleOptionHeader
*
option
) const
初始化 option 采用值來自此 QHeaderView 。此方法對子類是有用的,當需要 QStyleOptionHeader ,但不想自己填充所有信息。
另請參閱 QStyleOption::initFrom ().
Returns true if the header is clickable; otherwise returns false. A clickable header could be set up to allow the user to change the representation of the data in the view related to the header.
另請參閱 setClickable ().
Returns true if the header can be moved by the user; otherwise returns false.
另請參閱 setMovable ().
Returns true if the section specified by logicalIndex is explicitly hidden from the user; otherwise returns false.
另請參閱 hideSection (), showSection (), setSectionHidden (),和 hiddenSectionCount ().
返迴沿 Header (頭) 方嚮的長度。
另請參閱 sizeHint (), setResizeMode (),和 offset ().
Returns the logicalIndex for the section at the given visualIndex position, or -1 if visualIndex < 0 or visualIndex >= QHeaderView::count ().
注意, visualIndex is not affected by hidden sections.
另請參閱 visualIndex () 和 sectionPosition ().
Returns the section that covers the given position 在視口。
另請參閱 visualIndexAt () 和 isSectionHidden ().
Returns the logical index of the section at the given coordinate. If the header is horizontal x will be used, otherwise y will be used to find the logical index.
Returns the logical index of the section at the position given in pos . If the header is horizontal the x-coordinate will be used, otherwise the y-coordinate will be used to find the logical index.
另請參閱 sectionPosition ().
[virtual protected]
void
QHeaderView::
mouseDoubleClickEvent
(
QMouseEvent
*
e
)
重實現自 QWidget::mouseDoubleClickEvent ().
[virtual protected]
void
QHeaderView::
mouseMoveEvent
(
QMouseEvent
*
e
)
重實現自 QWidget::mouseMoveEvent ().
[virtual protected]
void
QHeaderView::
mousePressEvent
(
QMouseEvent
*
e
)
重實現自 QWidget::mousePressEvent ().
[virtual protected]
void
QHeaderView::
mouseReleaseEvent
(
QMouseEvent
*
e
)
重實現自 QWidget::mouseReleaseEvent ().
Moves the section at visual index from to occupy visual index to .
另請參閱 sectionsMoved ().
Returns the offset of the header: this is the header's left-most (or top-most for vertical headers) visible pixel.
另請參閱 setOffset ().
返迴頭的取嚮。
另請參閱 Qt::Orientation .
[virtual protected]
void
QHeaderView::
paintEvent
(
QPaintEvent
*
e
)
重實現自 QWidget::paintEvent ().
[virtual protected]
void
QHeaderView::
paintSection
(
QPainter
*
painter
, const
QRect
&
rect
,
int
logicalIndex
) const
Paints the section specified by the given logicalIndex ,使用給定 painter and rect .
通常,不必調用此函數。
[虛擬]
void
QHeaderView::
reset
()
重實現自 QAbstractItemView::reset ().
Returns the resize mode that applies to the section specified by the given logicalIndex .
另請參閱 setResizeMode ().
重置區間大小指定通過 logicalIndex to size measured in pixels.
另請參閱 sectionResized (), resizeMode (),和 sectionSize ().
Resizes the sections according to the given mode , ignoring the current resize mode.
另請參閱 resizeMode () 和 sectionResized ().
[protected slot]
void
QHeaderView::
resizeSections
()
調整區間大小根據其大小提示。通常,不必調用此函數。
還原
state
of this header view. This function returns
true
if the state was restored; otherwise returns false.
該函數在 Qt 4.3 引入。
另請參閱 saveState ().
保存此頭視圖的當前狀態。
要還原保存狀態,把返迴值傳遞給 restoreState ().
該函數在 Qt 4.3 引入。
另請參閱 restoreState ().
[signal]
void
QHeaderView::
sectionAutoResize
(
int
logicalIndex
,
QHeaderView::ResizeMode
mode
)
This signal is emitted when a section is automatically resized. The section's logical index is specified by logicalIndex , and the resize mode by mode .
另請參閱 setResizeMode () 和 stretchLastSection ().
[signal]
void
QHeaderView::
sectionClicked
(
int
logicalIndex
)
此信號被發射當點擊區間時。區間邏輯索引指定由 logicalIndex .
注意, sectionPressed 信號也會被發射。
另請參閱 setClickable () 和 sectionPressed ().
[signal]
void
QHeaderView::
sectionCountChanged
(
int
oldCount
,
int
newCount
)
This signal is emitted when the number of sections changes, i.e., when sections are added or deleted. The original count is specified by oldCount , and the new count by newCount .
另請參閱 count (), length (),和 headerDataChanged ().
[signal]
void
QHeaderView::
sectionDoubleClicked
(
int
logicalIndex
)
This signal is emitted when a section is double-clicked. The section's logical index is specified by logicalIndex .
另請參閱 setClickable ().
[signal]
void
QHeaderView::
sectionEntered
(
int
logicalIndex
)
This signal is emitted when the cursor moves over the section and the left mouse button is pressed. The section's logical index is specified by logicalIndex .
該函數在 Qt 4.3 引入。
另請參閱 setClickable () 和 sectionPressed ().
[signal]
void
QHeaderView::
sectionHandleDoubleClicked
(
int
logicalIndex
)
This signal is emitted when a section is double-clicked. The section's logical index is specified by logicalIndex .
另請參閱 setClickable ().
[signal]
void
QHeaderView::
sectionMoved
(
int
logicalIndex
,
int
oldVisualIndex
,
int
newVisualIndex
)
This signal is emitted when a section is moved. The section's logical index is specified by logicalIndex , the old index by oldVisualIndex , and the new index position by newVisualIndex .
另請參閱 moveSection ().
Returns the section position of the given logicalIndex , or -1 if the section is hidden. The position is measured in pixels from the first visible item's top-left corner to the top-left corner of the item with logicalIndex . The measurement is along the x-axis for horizontal headers and along the y-axis for vertical headers.
另請參閱 sectionViewportPosition ().
[signal]
void
QHeaderView::
sectionPressed
(
int
logicalIndex
)
This signal is emitted when a section is pressed. The section's logical index is specified by logicalIndex .
另請參閱 setClickable ().
[signal]
void
QHeaderView::
sectionResized
(
int
logicalIndex
,
int
oldSize
,
int
newSize
)
This signal is emitted when a section is resized. The section's logical number is specified by logicalIndex , the old size by oldSize , and the new size by newSize .
另請參閱 resizeSection ().
Returns the width (or height for vertical headers) of the given logicalIndex .
另請參閱 length (), setResizeMode (),和 defaultSectionSize ().
[virtual protected]
QSize
QHeaderView::
sectionSizeFromContents
(
int
logicalIndex
) const
Returns the size of the contents of the section specified by the given logicalIndex .
另請參閱 defaultSectionSize ().
Returns a suitable size hint for the section specified by logicalIndex .
另請參閱 sizeHint (), defaultSectionSize (), minimumSectionSize (),和 Qt::SizeHintRole .
返迴區間視口位置為給定 logicalIndex .
若區間被隱藏,返迴值未定義。
另請參閱 sectionPosition () 和 isSectionHidden ().
[protected slot]
void
QHeaderView::
sectionsAboutToBeRemoved
(const
QModelIndex
&
parent
,
int
logicalFirst
,
int
logicalLast
)
此槽被調用,當移除區間從 parent . logicalFirst and logicalLast signify where the sections were removed.
If only one section is removed, logicalFirst and logicalLast will be the same.
Returns true if sections in the header has been hidden; otherwise returns false;
該函數在 Qt 4.1 引入。
另請參閱 setSectionHidden ().
[protected slot]
void
QHeaderView::
sectionsInserted
(const
QModelIndex
&
parent
,
int
logicalFirst
,
int
logicalLast
)
This slot is called when sections are inserted into the parent . logicalFirst and logicalLast indices signify where the new sections were inserted.
If only one section is inserted, logicalFirst and logicalLast will be the same.
Returns true if sections in the header has been moved; otherwise returns false;
另請參閱 moveSection ().
若 clickable 為 true,頭將響應單擊。
另請參閱 isClickable (), sectionClicked (), sectionPressed (),和 setSortIndicatorShown ().
[虛擬]
void
QHeaderView::
setModel
(
QAbstractItemModel
*
model
)
重實現自 QAbstractItemView::setModel ().
若 movable is true, the header may be moved by the user; otherwise it is fixed in place.
另請參閱 isMovable () 和 sectionMoved ().
[slot]
void
QHeaderView::
setOffset
(
int
offset
)
把 Header (頭部) 偏移設為 offset .
[slot]
void
QHeaderView::
setOffsetToLastSection
()
設置偏移以使最後區間可見。
該函數在 Qt 4.2 引入。
另請參閱 setOffset (), sectionPosition (),和 setOffsetToSectionPosition ().
[slot]
void
QHeaderView::
setOffsetToSectionPosition
(
int
visualIndex
)
Sets the offset to the start of the section at the given visualIndex .
該函數在 Qt 4.2 引入。
另請參閱 setOffset () 和 sectionPosition ().
設置如何把頭重置到哪些描述大小的約束通過給定 mode .
另請參閱 resizeMode (), length (), sectionResized (),和 sectionAutoResize ().
這是重載函數。
設置區間如何被約束指定通過 logicalIndex 在 Header (頭) 中可以重置到那些描述大小通過給定 mode 。邏輯索引應該存在,當此函數被調用時。
注意: 最後區間會忽略此設置若 stretchLastSection 特性被設為 true。這是默認的對於水平頭提供通過 QTreeView .
另請參閱 setStretchLastSection ().
若 hide 為 true 區間指定通過 logicalIndex 被隱藏;否則展示區間。
另請參閱 isSectionHidden () 和 hiddenSectionCount ().
[virtual protected]
void
QHeaderView::
setSelection
(const
QRect
&
rect
,
QItemSelectionModel::SelectionFlags
flags
)
重實現自 QAbstractItemView::setSelection ().
Selects the items in the given rect 根據指定 flags .
基類實現什麼都不做。
Sets the sort indicator for the section specified by the given logicalIndex in the direction specified by order , and removes the sort indicator from any other section that was showing it.
logicalIndex 可以是 -1,在這種情況下,不會展示排序指示器,且模型將返迴其自然、未排序次序。注意,所有模型並非都支持這,且在這種情況下甚至可能崩潰。
另請參閱 sortIndicatorSection () 和 sortIndicatorOrder ().
顯示指定區間通過 logicalIndex .
另請參閱 hideSection (), isSectionHidden (), hiddenSectionCount (),和 setSectionHidden ().
[虛擬]
QSize
QHeaderView::
sizeHint
() const
重實現自 QWidget::sizeHint ().
返迴用於此 Header (頭) 的閤適大小提示。
另請參閱 sectionSizeHint ().
[signal]
void
QHeaderView::
sortIndicatorChanged
(
int
logicalIndex
,
Qt::SortOrder
order
)
This signal is emitted when the section containing the sort indicator or the order indicated is changed. The section's logical index is specified by logicalIndex and the sort order is specified by order .
該函數在 Qt 4.3 引入。
另請參閱 setSortIndicator ().
Returns the order for the sort indicator. If no section has a sort indicator the return value of this function is undefined.
另請參閱 setSortIndicator () 和 sortIndicatorSection ().
Returns the logical index of the section that has a sort indicator. By default this is section 0.
另請參閱 setSortIndicator (), sortIndicatorOrder (),和 setSortIndicatorShown ().
Returns the number of sections that are set to resize mode stretch. In views, this can be used to see if the headerview needs to resize the sections when the view's geometry changes.
該函數在 Qt 4.1 引入。
另請參閱 stretchLastSection and resizeMode ().
Swaps the section at visual index first with the section at visual index second .
該函數在 Qt 4.2 引入。
另請參閱 moveSection ().
[virtual protected]
int
QHeaderView::
verticalOffset
() const
重實現自 QAbstractItemView::verticalOffset ().
返迴 Header (頭) 的垂直偏移。水平頭這為 0。
另請參閱 offset ().
[virtual protected]
bool
QHeaderView::
viewportEvent
(
QEvent
*
e
)
重實現自 QAbstractScrollArea::viewportEvent ().
Returns the visual index position of the section specified by the given logicalIndex ,否則 -1。
被隱藏區間仍具有有效視覺索引。
另請參閱 logicalIndex ().
Returns the visual index of the section that covers the given position 在視口。
另請參閱 logicalIndexAt ().