QPersistentModelIndex Class
QPersistentModelIndex 클래스는 데이터 모델 내에서 데이터를 찾는 데 사용됩니다. 더 보기...
| 헤더: | #include <QPersistentModelIndex> |
| CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
| qmake: | QT += core |
- 상속된 멤버를 포함한 모든 멤버 목록
- QPersistentModelIndex는 ‘암시적 공유 클래스’의 일부입니다.
QPersistentModelIndex 비교
| 범주 | 비교 가능한 유형 |
|---|---|
| strong | QPersistentModelIndex |
| strong | QModelIndex. |
공개 함수
| QPersistentModelIndex(const QModelIndex &index) | |
| QPersistentModelIndex(const QPersistentModelIndex &other) | |
| QPersistentModelIndex(QPersistentModelIndex &&other) | |
| int | column() const |
| QVariant | data(int role = Qt::DisplayRole) const |
| Qt::ItemFlags | flags() const |
| bool | isValid() const |
| const QAbstractItemModel * | model() const |
(since 6.0) void | multiData(QModelRoleDataSpan roleDataSpan) const |
| QModelIndex | parent() const |
| int | row() const |
| QModelIndex | sibling(int row, int column) const |
| void | swap(QPersistentModelIndex &other) |
| operator QModelIndex() const | |
| QPersistentModelIndex & | operator=(QPersistentModelIndex &&other) |
| QPersistentModelIndex & | operator=(const QModelIndex &other) |
| QPersistentModelIndex & | operator=(const QPersistentModelIndex &other) |
관련 비회원
| size_t | qHash(const QPersistentModelIndex &key, size_t seed = 0) |
| bool | operator!=(const QPersistentModelIndex &lhs, const QModelIndex &rhs) |
| bool | operator!=(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs) |
| bool | operator<(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs) |
| bool | operator==(const QPersistentModelIndex &lhs, const QModelIndex &rhs) |
| bool | operator==(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs) |
상세 설명
QPersistentModelIndex는 애플리케이션에서 저장할 수 있으며, 나중에 모델 내의 정보에 접근하는 데 사용할 수 있는 모델 인덱스입니다. QModelIndex 클래스와는 달리, 모델이 해당 항목에 대한 참조가 모델에서 접근할 수 있는 한 계속 유효하도록 보장하므로 QPersistentModelIndex를 저장하는 것은 안전합니다.
지속적 모델 인덱스를 사용하기 전에 유효한지 확인하는 것이 좋습니다.
참고: QStandardItemModel 의 QPersistentModelIndex를 모델의 항목 중 하나에 저장할수는 없습니다.
또한 Model/View 프로그래밍, QModelIndex 및 QAbstractItemModel 을참조하십시오 .
멤버 함수 문서
QPersistentModelIndex::QPersistentModelIndex(const QModelIndex &index)
index 모델의 복사본인 새로운 QPersistentModelIndex를 생성합니다.
QPersistentModelIndex::QPersistentModelIndex(const QPersistentModelIndex &other)
other 의 영구 모델 인덱스를 복사한 새로운 QPersistentModelIndex를 생성합니다.
[noexcept] QPersistentModelIndex::QPersistentModelIndex(QPersistentModelIndex &&other)
QPersistentModelIndex 인스턴스를 생성하여, 해당 인스턴스가 other 가 가리키던 것과 동일한 객체를 가리키도록 합니다.
int QPersistentModelIndex::column() const
이 영구 모델 인덱스가 가리키는 열을 반환합니다.
QVariant QPersistentModelIndex::data(int role = Qt::DisplayRole) const
지정된 지속형 모델( role )에 대해 인덱스가 가리키는 항목의 데이터를 반환하거나, 해당 지속형 모델 인덱스가 ` invalid`인 경우 기본 생성된 지속형 모델( QVariant )을 반환합니다.
Qt::ItemDataRole 및 QAbstractItemModel::setData()도 참조하십시오 .
Qt::ItemFlags QPersistentModelIndex::flags() const
인덱스가 가리키는 항목에 대한 플래그를 반환합니다.
bool QPersistentModelIndex::isValid() const
이 영구 모델 인덱스가 유효한 경우 ` true `를 반환하고, 그렇지 않은 경우 ` false`를 반환합니다.
유효한 인덱스는 특정 모델에 속하며, 행 번호와 열 번호가 모두 0 이상이어야 합니다.
model(), row() 및 column()도 참조하십시오 .
const QAbstractItemModel *QPersistentModelIndex::model() const
해당 인덱스가 속한 모델을 반환합니다.
[since 6.0] void QPersistentModelIndex::multiData(QModelRoleDataSpan roleDataSpan) const
인덱스가 가리키는 항목에 대한 지정된 ` roleDataSpan `를 채웁니다.
이 함수는 Qt 6.0에서 도입되었습니다.
Qt::ItemDataRole 및 QAbstractItemModel::setData()도 참조하십시오 .
QModelIndex QPersistentModelIndex::parent() const
이 영구 인덱스의 상위 인덱스 QModelIndex 를 반환하거나, 상위 인덱스가 없는 경우 유효하지 않은 인덱스 QModelIndex 를 반환합니다.
int QPersistentModelIndex::row() const
이 영구 모델 인덱스가 가리키는 행을 반환합니다.
QModelIndex QPersistentModelIndex::sibling(int row, int column) const
row 및 column 에 있는 형제 노드를 반환하거나, 해당 위치에 형제 노드가 없는 경우 유효하지 않은 QModelIndex 를 반환합니다.
parent()도 참조하십시오 .
[noexcept] void QPersistentModelIndex::swap(QPersistentModelIndex &other)
이 영구 모델 인덱스를 other 로 교체합니다. 이 작업은 매우 빠르며 실패하는 일이 없습니다.
QPersistentModelIndex::operator QModelIndex() const
QModelIndex 를 반환하는 형변환 연산자.
[noexcept] QPersistentModelIndex &QPersistentModelIndex::operator=(QPersistentModelIndex &&other)
other 를 이 QPersistentModelIndex 인스턴스에 할당합니다.
QPersistentModelIndex &QPersistentModelIndex::operator=(const QModelIndex &other)
영구 모델 인덱스가 ‘ other ’ 모델 인덱스와 동일한 모델 내 항목을 가리키도록 설정합니다.
QPersistentModelIndex &QPersistentModelIndex::operator=(const QPersistentModelIndex &other)
영구 모델 인덱스를 설정하여, ‘ other ’ 영구 모델 인덱스와 동일한 모델 내 항목을 가리키도록 합니다.
관련된 비회원
[noexcept] size_t qHash(const QPersistentModelIndex &key, size_t seed = 0)
seed 를 계산의 시드로 사용하여 key 에 대한 해시 값을 반환합니다.
[noexcept] bool operator!=(const QPersistentModelIndex &lhs, const QModelIndex &rhs)
lhs 의 영구 모델 인덱스가 rhs 의 모델 인덱스와 동일한 위치를 가리키지 않는 경우 true 를 반환하고, 그렇지 않은 경우 false 를 반환합니다.
[noexcept] bool operator!=(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs)
lhs 의 영구 모델 인덱스가 rhs 의 영구 모델 인덱스와 일치하지 않으면 true 를 반환하고, 그렇지 않으면 false 를 반환합니다.
[noexcept] bool operator<(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs)
lhs 의 영구 모델 인덱스가 rhs 의 영구 모델 인덱스보다 작으면 true 를 반환하고, 그렇지 않으면 false 를 반환합니다.
다른 영구 모델 인덱스와 비교할 때는 해당 영구 모델 인덱스의 내부 데이터 포인터, 행, 열 및 모델 값이 사용됩니다.
[noexcept] bool operator==(const QPersistentModelIndex &lhs, const QModelIndex &rhs)
lhs 의 영구 모델 인덱스가 rhs 의 모델 인덱스와 동일한 위치를 가리키는 경우 true 를 반환하고, 그렇지 않은 경우 false 를 반환합니다.
다른 모델 인덱스와 비교할 때는 영구 모델 인덱스 내의 내부 데이터 포인터, 행, 열 및 모델 값이 사용됩니다.
[noexcept] bool operator==(const QPersistentModelIndex &lhs, const QPersistentModelIndex &rhs)
lhs 의 영구 모델 인덱스가 rhs 의 영구 모델 인덱스와 동일한 경우 ` true `를 반환하고, 그렇지 않은 경우 ` false`를 반환합니다.
다른 영구 모델 인덱스와 비교할 때는 해당 영구 모델 인덱스의 내부 데이터 포인터, 행, 열 및 모델 값이 사용됩니다.
© 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.