summaryrefslogtreecommitdiffstats
path: root/src
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 /src
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 'src')
-rw-r--r--src/corelib/itemmodels/qabstractproxymodel.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/corelib/itemmodels/qabstractproxymodel.cpp b/src/corelib/itemmodels/qabstractproxymodel.cpp
index 39fe44464c..d8a93eee36 100644
--- a/src/corelib/itemmodels/qabstractproxymodel.cpp
+++ b/src/corelib/itemmodels/qabstractproxymodel.cpp
@@ -268,7 +268,8 @@ QVariant QAbstractProxyModel::headerData(int section, Qt::Orientation orientatio
*/
QMap<int, QVariant> QAbstractProxyModel::itemData(const QModelIndex &proxyIndex) const
{
- return QAbstractItemModel::itemData(proxyIndex);
+ Q_D(const QAbstractProxyModel);
+ return d->model->itemData(mapToSource(proxyIndex));
}
/*!
@@ -294,7 +295,8 @@ bool QAbstractProxyModel::setData(const QModelIndex &index, const QVariant &valu
*/
bool QAbstractProxyModel::setItemData(const QModelIndex &index, const QMap< int, QVariant >& roles)
{
- return QAbstractItemModel::setItemData(index, roles);
+ Q_D(QAbstractProxyModel);
+ return d->model->setItemData(mapToSource(index), roles);
}
/*!