![]() |
Qt 6.x
The Qt SDK
|
\inmodule QtCore More...
#include <qabstractitemmodel.h>
Public Member Functions | |
QModelRoleData (int role) noexcept | |
Constructs a QModelRoleData object for the given role. | |
constexpr int | role () const noexcept |
Returns the role held by this object. | |
constexpr QVariant & | data () noexcept |
Returns the data held by this object as a modifiable reference. | |
constexpr const QVariant & | data () const noexcept |
Returns the data held by this object. | |
template<typename T > | |
constexpr void | setData (T &&value) noexcept(noexcept(m_data.setValue(std::forward< T >(value)))) |
Sets the data held by this object to value. | |
void | clearData () noexcept |
Clears the data held by this object. | |
\inmodule QtCore
The QModelRoleData class holds a role and the data associated to that role.
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.
Definition at line 17 of file qabstractitemmodel.h.
|
inlineexplicitnoexcept |
Constructs a QModelRoleData object for the given role.
Definition at line 23 of file qabstractitemmodel.h.
|
inlinenoexcept |
Clears the data held by this object.
Note that the role is unchanged; only the data is cleared.
Definition at line 35 of file qabstractitemmodel.h.
References m_data.
|
inlineconstexprnoexcept |
Returns the data held by this object.
Definition at line 29 of file qabstractitemmodel.h.
References m_data.
|
inlineconstexprnoexcept |
Returns the data held by this object as a modifiable reference.
Definition at line 28 of file qabstractitemmodel.h.
References m_data.
|
inlineconstexprnoexcept |
Returns the role held by this object.
Definition at line 27 of file qabstractitemmodel.h.
|
inlineconstexprnoexcept |
Sets the data held by this object to value.
value must be of a datatype which can be stored in a QVariant.
Definition at line 32 of file qabstractitemmodel.h.
References m_data.