QModelRoleData Class▲
-
Header: QModelRoleData
-
Since: Qt 6.0
-
CMake:
find_package(Qt6 REQUIRED COMPONENTS Core)
target_link_libraries(mytarget PRIVATE Qt6::Core)
-
qmake: QT += core
-
Group: QModelRoleData is part of model-view
Detailed Description▲
QModelRoleData objects store an item role (which is a value from the Qt::ItemDataRole enumeration, or an arbitrary integer for a custom role) as well as the data associated with that role.
A QModelRoleData object is typically created by views or delegates, setting which role they want to fetch the data for. The object is then passed to models (see QAbstractItemModel::multiData()), which populate the data corresponding to the role stored. Finally, the view visualizes the data retrieved from the model.
See Also▲
See also Model/View Programming, QModelRoleDataSpan
Member Function Documentation▲
[explicit] QModelRoleData::QModelRoleData(int role)▲
void QModelRoleData::clearData()▲
Clears the data held by this object. Note that the role is unchanged; only the data is cleared.
See Also▲
See also data()
[constexpr] QVariant &QModelRoleData::data()▲
[constexpr] const QVariant &QModelRoleData::data() const▲
[constexpr] int QModelRoleData::role() const▲
[constexpr] void QModelRoleData::setData(T &&value)▲
Sets the data held by this object to value. value must be of a datatype which can be stored in a QVariant.
See Also▲
See also data(), clearData(), Q_DECLARE_METATYPE