IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)

QModelRoleData Class

The QModelRoleData class holds a role and the data associated to that role.

This class was introduced in Qt 6.0.

Article lu   fois.

L'auteur

Liens sociaux

Viadeo Twitter Facebook Share on Google+   

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

Member Function Documentation

 

[explicit] QModelRoleData::QModelRoleData(int role)

Constructs a QModelRoleData object for the given role.

See Also

See also Qt::ItemDataRole

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()

Returns the data held by this object as a modifiable reference.

See Also

See also setData()

[constexpr] const QVariant &QModelRoleData::data() const

Returns the data held by this object.

See Also

See also setData()

[constexpr] int QModelRoleData::role() const

Returns the role held by this object.

See Also

See also Qt::ItemDataRole

[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

Vous avez aimé ce tutoriel ? Alors partagez-le en cliquant sur les boutons suivants : Viadeo Twitter Facebook Share on Google+