qt5base-lts/tests/auto/corelib/itemmodels/qabstractitemmodel
Stephen Kelly c3ad8c1c06 Make the roleNames a virtual accessor.
This is consistent with the rest of the API of QAbstractItemModel
(which is virtual) and removes the need for code like this
in the constructor (where it doesn't belong):

QHash<int, QByteArray> myRoleNames = roleNames();
myRoleNames.insert(Qt::UserRole + 1, "myCustomRole");
setRoleNames(myRoleNames);

in favor of

MyModel::roleNames() const {
  QHash<int, QByteArray> myRoleNames = QAbstractItemModel::roleNames();
  myRoleNames.insert(Qt::UserRole + 1, "myCustomRole");
  return myRoleNames;
}

which is consistent with all other QAIM API (eg, flags()).

This is a source compatible change.

Change-Id: I7e1ce17f8dab2292c4c7b6dbd3c09ec71b5c793b
Reviewed-by: David Faure <faure@kde.org>
Reviewed-by: Marius Bugge Monsen <marius@cutehacks.com>
2012-01-10 11:37:28 +01:00
..
.gitignore Move QAbstractItemModel into a separate directory. 2011-12-13 02:23:42 +01:00
qabstractitemmodel.pro Move QAbstractItemModel into a separate directory. 2011-12-13 02:23:42 +01:00
tst_qabstractitemmodel.cpp Make the roleNames a virtual accessor. 2012-01-10 11:37:28 +01:00