summaryrefslogtreecommitdiffstats
path: root/src/corelib/itemmodels/qtransposeproxymodel.cpp
diff options
context:
space:
mode:
authorLuca Beldi <v.ronin@yahoo.it>2021-04-19 16:51:37 +0100
committerLuca Beldi <v.ronin@yahoo.it>2021-04-19 21:42:55 +0100
commit3c74ee568289af7500f165c4d29f380eefa1f4b9 (patch)
tree165caf6f195758e59bed612153feb27139f317df /src/corelib/itemmodels/qtransposeproxymodel.cpp
parentfed2c0d23614df1b96dcc8746223501b07597a52 (diff)
Allow proxy models access to the parent-child hierarchy of source
As discussed in the related bug report, the current way proxy models access the parent-child hierarchy of the source model requires modifying Qt sources. This changes adds a method to allow easy implementation of this common feature to proxy model subclasses. Fixes: QTBUG-83911 Change-Id: Ic88d40c13c2be7b6b44fcc58118bac471a11da95 Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/corelib/itemmodels/qtransposeproxymodel.cpp')
-rw-r--r--src/corelib/itemmodels/qtransposeproxymodel.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/src/corelib/itemmodels/qtransposeproxymodel.cpp b/src/corelib/itemmodels/qtransposeproxymodel.cpp
index 83a86d1a97..899f93c2a5 100644
--- a/src/corelib/itemmodels/qtransposeproxymodel.cpp
+++ b/src/corelib/itemmodels/qtransposeproxymodel.cpp
@@ -49,9 +49,8 @@ QModelIndex QTransposeProxyModelPrivate::uncheckedMapToSource(const QModelIndex
{
if (!model || !proxyIndex.isValid())
return QModelIndex();
- if (proxyIndex.internalPointer())
- return model->createIndex(proxyIndex.column(), proxyIndex.row(), proxyIndex.internalPointer());
- return model->index(proxyIndex.column(), proxyIndex.row());
+ Q_Q(const QTransposeProxyModel);
+ return q->createSourceIndex(proxyIndex.column(), proxyIndex.row(), proxyIndex.internalPointer());
}
QModelIndex QTransposeProxyModelPrivate::uncheckedMapFromSource(const QModelIndex &sourceIndex) const