diff options
author | Luca Beldi <v.ronin@yahoo.it> | 2021-04-19 16:51:37 +0100 |
---|---|---|
committer | Luca Beldi <v.ronin@yahoo.it> | 2021-04-19 21:42:55 +0100 |
commit | 3c74ee568289af7500f165c4d29f380eefa1f4b9 (patch) | |
tree | 165caf6f195758e59bed612153feb27139f317df /src/corelib/itemmodels/qtransposeproxymodel.cpp | |
parent | fed2c0d23614df1b96dcc8746223501b07597a52 (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.cpp | 5 |
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 |