ItemSelectionModel QML Type
QAbstractItemModel 및 이를 지원하는 모든 뷰와 함께 사용하기 위해 QItemSelectionModel 객체를 인스턴스화합니다. 더 보기...
| Import Statement: | import QtQml.Models |
| In C++: | QItemSelectionModel |
속성
- currentIndex : QModelIndex
- hasSelection : bool
- model : QAbstractItemModel
- selectedIndexes : list<var>
- selection : object
신호
- currentChanged(QModelIndex current, QModelIndex previous)
- selectionChanged(QItemSelection selected, QItemSelection deselected)
방법
- void clear()
- void clearCurrentIndex()
- void clearSelection()
- bool columnIntersectsSelection(int column, QModelIndex parent)
- bool isColumnSelected(int column, QModelIndex parent)
- bool isRowSelected(int row, QModelIndex parent)
- bool isSelected(QModelIndex index)
- void reset()
- bool rowIntersectsSelection(int row, QModelIndex parent)
- void select(QItemSelection selection, SelectionFlags command)
- void select(QModelIndex index, SelectionFlags command)
- list<var> selectedColumns(int row)
- list<var> selectedRows(int column)
- void setCurrentIndex(QModelIndex index, SelectionFlags command)
자세한 설명
QItemSelectionModel 및 Qt Quick 의 ‘모델과 뷰’항목도 참조하십시오 .
속성 문서
currentIndex : QModelIndex [read-only]
setCurrentIndex()를 사용하여 해당 값을 설정하십시오.
setCurrentIndex() 및 currentChanged()도 참조하십시오 .
hasSelection : bool [read-only]
selectionChanged()가 발생될 때마다, 값이 변경되지 않았더라도 속성 바인딩 업데이트가 트리거됩니다.
selection, selectedIndexes, select() 및 selectionChanged()도 참조하십시오 .
model : QAbstractItemModel
이 속성의 값은 뷰의 모델과 일치해야 합니다.
selectedIndexes : list<var> [read-only]
선택 모델에 포함된 모든 인덱스(QModelIndex 인스턴스)의 목록을 포함합니다.
QModelIndexList 유형도참조하십시오 .
selection : object [read-only]
선택 모델에 저장된 선택 범위를 보관합니다.
신호 설명서
currentChanged(QModelIndex current, QModelIndex previous)
이 신호는 현재 항목이 변경될 때마다 발생합니다. 선택 항목의 현재 항목으로 previous 모델 항목 인덱스가 current 인덱스로 대체됩니다.
항목 모델이 재설정될 때는 이 신호가 발생하지 않는다는 점에 유의하십시오.
참고: 해당 핸들러는 onCurrentChanged 입니다.
currentIndex, setCurrentIndex() 및 selectionChanged()도 참조하십시오 .
selectionChanged(QItemSelection selected, QItemSelection deselected)
이 신호는 선택 내용이 변경될 때마다 발생합니다. 선택 내용의 변경은 deselected 항목의 항목 선택과 selected 항목의 항목 선택으로 표현됩니다.
현재 인덱스는 선택 항목과 별개로 변경된다는 점에 유의하십시오. 또한 항목 모델이 재설정될 때는 이 신호가 발생하지 않는다는 점에도 유의하십시오.
참고: 해당 핸들러는 onSelectionChanged 입니다.
select() 및 currentChanged()도 참조하십시오 .
메서드 설명서
void clear()
선택 모델을 지웁니다. ` selectionChanged()` 및 ` currentChanged()` 이벤트를 발생시킵니다.
void clearCurrentIndex()
현재 인덱스를 지웁니다. ` currentChanged()`를 발생시킵니다.
void clearSelection()
선택 모델에서 선택 항목을 지웁니다. ` selectionChanged()` 이벤트를 발생시킵니다.
bool columnIntersectsSelection(int column, QModelIndex parent)
column 에 지정된 parent 을 가진 항목이 하나라도 선택되어 있으면 true 를 반환합니다.
bool isColumnSelected(int column, QModelIndex parent)
지정된 parent 를 사용하여 column 내의 모든 항목이 선택된 경우 true 를 반환합니다.
이 함수는 일반적으로 같은 열의 모든 항목에 대해 isSelected()를 호출하는 것보다 빠르며, 선택 불가능한 항목은 무시된다는 점에 유의하십시오.
bool isRowSelected(int row, QModelIndex parent)
지정된 parent 을 사용하여 row 의 모든 항목이 선택된 경우 true 를 반환합니다.
이 함수는 일반적으로 같은 행의 모든 항목에 대해 isSelected()를 호출하는 것보다 빠르며, 선택할 수 없는 항목은 무시된다는 점에 유의하십시오.
bool isSelected(QModelIndex index)
지정된 모델 항목 index 이 선택된 경우 ` true `를 반환합니다.
void reset()
선택 모델을 지웁니다. 신호를 발생시키지 않습니다.
bool rowIntersectsSelection(int row, QModelIndex parent)
row 에 지정된 parent 을 가진 항목이 하나라도 선택되어 있는 경우, ` true `을 반환합니다.
void select(QItemSelection selection, SelectionFlags command)
지정된 ` command`를 사용하여 ` selection ` 항목을 선택하고, ` selectionChanged()`를 출력합니다.
유효한 command 값에 대한 설명은 select(index, command)에 설명되어 있습니다.
void select(QModelIndex index, SelectionFlags command)
지정된 ` command`를 사용하여 모델 항목 ` index `를 선택하고, ` selectionChanged()`를 출력합니다.
command 매개변수의 유효한 값은 다음과 같습니다.
| 상수 | 설명 |
|---|---|
NoUpdate | 선택이 이루어지지 않습니다. |
Clear | 선택된 항목이 모두 지워집니다. |
Select | 지정된 모든 인덱스가 선택됩니다. |
Deselect | 지정된 모든 인덱스의 선택이 해제됩니다. |
Toggle | 지정된 모든 인덱스는 현재 상태에 따라 선택되거나 선택이 해제됩니다. |
Current | 현재 선택 사항이 업데이트됩니다. |
Rows | 모든 인덱스가 행을 포괄하도록 확장됩니다. |
Columns | 모든 인덱스가 열을 가로지르도록 확장됩니다. |
SelectCurrent | 편의를 위해 '선택'과 '현재'의 조합이 제공됩니다. |
ToggleCurrent | 편의를 위해 ‘토글’과 ‘현재’의 조합이 제공됩니다. |
ClearAndSelect | 편의를 위해 '지우기'와 '선택'을 조합한 기능입니다. |
list<var> selectedColumns(int row)
주어진 ` row `에서 모든 행이 선택된 열에 대한 인덱스( QModelIndex 인스턴스 목록)를 반환합니다.
selectedRows() 및 QModelIndexList 타입도참조하십시오 .
list<var> selectedRows(int column)
주어진 column 에서 모든 열이 선택된 행에 대한 인덱스( QModelIndex 인스턴스의 목록)를 반환합니다.
selectedColumns() 및 QModelIndexList 타입도참조하십시오 .
void setCurrentIndex(QModelIndex index, SelectionFlags command)
모델 항목 index 을 현재 항목으로 설정하고, currentChanged()를 발생시킵니다. 현재 항목은 키보드 탐색 및 포커스 표시를 위해 사용되며, 선택된 항목과는 별개이지만 선택된 항목이 현재 항목이 될 수도 있습니다.
지정된 command 에 따라, index 도 현재 선택 항목의 일부가 될 수 있습니다.
유효한 command 값에 대한 설명은 select(index, command).
select()도 참조하십시오 .
© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.