QModelRoleData Class
QModelRoleData 클래스는 역할과 해당 역할에 연결된 데이터를 보유합니다. 더 보기...
헤더: | #include <QModelRoleData> |
CMake: | find_package(Qt6 REQUIRED COMPONENTS Core) target_link_libraries(mytarget PRIVATE Qt6::Core) |
qmake: | QT += core |
이후: | Qt 6.0 |
공용 함수
QModelRoleData(int role) | |
void | clearData() |
QVariant & | data() |
const QVariant & | data() const |
int | role() const |
void | setData(T &&value) |
자세한 설명
QModelRoleData 객체는 항목 역할( Qt::ItemDataRole 열거형의 값 또는 사용자 지정 역할의 경우 임의의 정수)과 해당 역할과 연관된 데이터를 저장합니다.
일반적으로 뷰 또는 델리게이트가 데이터를 가져올 역할을 설정하여 QModelRoleData 개체를 만듭니다. 그런 다음 이 개체는 모델에 전달되어( QAbstractItemModel::multiData() 참조) 저장된 역할에 해당하는 데이터를 채웁니다. 마지막으로 뷰는 모델에서 검색된 데이터를 시각화합니다.
모델/뷰 프로그래밍 및 QModelRoleDataSpan 을참조하세요 .
멤버 함수 문서
[explicit noexcept]
QModelRoleData::QModelRoleData(int role)
주어진 role 에 대한 QModelRoleData 객체를 구축합니다.
Qt::ItemDataRole도 참조하십시오 .
[noexcept]
void QModelRoleData::clearData()
이 객체가 보유한 데이터를 지웁니다. 역할은 변경되지 않으며 데이터만 지워집니다.
data()도 참조하세요 .
[constexpr noexcept]
QVariant &QModelRoleData::data()
이 객체가 보유한 데이터를 수정 가능한 참조로 반환합니다.
setData()도 참조하세요 .
[constexpr noexcept]
const QVariant &QModelRoleData::data() const
이 객체가 보유한 데이터를 반환합니다.
setData()도 참조하세요 .
[constexpr noexcept]
int QModelRoleData::role() const
이 객체가 보유한 역할을 반환합니다.
Qt::ItemDataRole도 참조하세요 .
[constexpr noexcept(...)]
template <typename T> void QModelRoleData::setData(T &&value)
이 객체가 보유한 데이터를 value 로 설정합니다. value 은 QVariant 에 저장할 수 있는 데이터 유형이어야 합니다.
참고: 이 함수는 noexcept(m_data.setValue(std::forward<T>(value)))
가 true
인 경우를 제외하고는 사용되지 않습니다.
data(), clearData() 및 Q_DECLARE_METATYPE 를참조하십시오 .
© 2025 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.