summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qabstractitemmodel.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/itemmodels/qabstractitemmodel.cpp')
-rw-r--r--src/corelib/itemmodels/qabstractitemmodel.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/corelib/itemmodels/qabstractitemmodel.cpp b/src/corelib/itemmodels/qabstractitemmodel.cpp
index e19d9479f8..47151a4aba 100644
--- a/src/corelib/itemmodels/qabstractitemmodel.cpp
+++ b/src/corelib/itemmodels/qabstractitemmodel.cpp
@@ -1898,10 +1898,17 @@ bool QAbstractItemModel::clearItemData(const QModelIndex &index)
*/
bool QAbstractItemModel::setItemData(const QModelIndex &index, const QMap<int, QVariant> &roles)
{
- bool b = true;
- for (QMap<int, QVariant>::ConstIterator it = roles.begin(); it != roles.end(); ++it)
- b = b && setData(index, it.value(), it.key());
- return b;
+ // ### Qt 6: Consider change the semantics of this function,
+ // or deprecating/removing it altogether.
+ //
+ // For instance, it should try setting *all* the data
+ // in \a roles, and not bail out at the first setData that returns
+ // false. It should also have a transactional approach.
+ for (auto it = roles.begin(), e = roles.end(); it != e; ++it) {
+ if (!setData(index, it.value(), it.key()))
+ return false;
+ }
+ return true;
}
/*!