summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorLuca Beldi <v.ronin@yahoo.it>2021-10-19 10:34:33 +0100
committerLuca Beldi <v.ronin@yahoo.it>2021-11-26 17:12:07 +0000
commitc27d2a57a441f9a1ce760e71635bd4c96882249d (patch)
tree6a78ea1875dfee91110b5ca23135c90c559fd8d9 /tests
parent99644a9e9441b0549fe2c178b34169c35036c46c (diff)
Make QAbstractProxyModel itemData() behave like data()
QAbstractProxyModel::itemData/setItemData should behave just like data()/setData() instead of calling the QAbstractItemModel implementation. Before this change the QAbstractProxyModel implementation calls its the QAbstractItemModel implementation, which ends up calling data()/setData() in a loop bypassing the convenience of itemData/setItemData. [ChangeLog][QtCore][QAbstractProxyModel] The itemData() and setItemData() functions will now call the respective implementations in the source model (after mapping the index to a source index), matching what data() and setData() already did. Before, the proxy model simply called the default implementations of itemData()/setItemData() in its own base class (QAbstractItemModel). Change-Id: I9e680d355f44fa130660dd7e1c8ac37484c1566e Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
index 3f93938ed9..72f3564746 100644
--- a/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
+++ b/tests/auto/corelib/itemmodels/qidentityproxymodel/tst_qidentityproxymodel.cpp
@@ -404,8 +404,17 @@ public:
const QVariant result = QIdentityProxyModel::data(index, role);
if (role != Qt::DisplayRole)
return result;
- return result.toString() + "_appended";
+ return result.toString() + QLatin1String("_appended");
}
+ QMap<int, QVariant> itemData(const QModelIndex &index) const override
+ {
+ QMap<int, QVariant> result = QIdentityProxyModel::itemData(index);
+ auto displayIter = result.find(Qt::DisplayRole);
+ if (displayIter != result.end())
+ displayIter.value() = displayIter.value().toString() + QLatin1String("_appended");
+ return result;
+ }
+
};
void tst_QIdentityProxyModel::itemData()