How does QAbstractItemView know about my custom roles when emitting dataChanged() with no roles?

287 views Asked by At

On receipt of the signal QAbstractItemModel::dataChanged(), the connected QAbstractItemViews will call the QAbstractItemModel::data() method to update their data. The user defined data() method should give different information based on both predefined roles like Qt::DisplayRole and any amount of user defined custom roles that should have values equivalent to Qt::UserRole and up.

With this in mind, Qt docs regarding the QAbstractItemModel::dataChanged() signal state this:

The optional roles argument can be used to specify which data roles have actually been modified. An empty vector in the roles argument means that all roles should be considered modified. The order of elements in the roles argument does not have any relevance.

http://doc.qt.io/qt-5/qabstractitemmodel.html#dataChanged

In light of this, how does the QAbstractItemView know to call all my custom roles when I call dataChanged with an empty vector of roles? Or does this only refer to the predefined Qt roles?

0

There are 0 answers