Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport release-3_0] Move from QModelIndex to QPersistentModelIndex in the layer tree proxy model class #4732

Merged
merged 1 commit into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/core/layertreemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ void FlatLayerTreeModelBase::insertInMap( const QModelIndex &parent, int first,

QMap<int, int> treeLevelMap;
mIndexMap.clear();
const QList<QModelIndex> keys = mRowMap.keys();
const QList<QPersistentModelIndex> keys = mRowMap.keys();
for ( const auto &index : keys )
{
int row = mRowMap[index];
Expand Down Expand Up @@ -291,7 +291,7 @@ void FlatLayerTreeModelBase::removeFromMap( const QModelIndex &parent, int first

QMap<int, int> treeLevelMap;
mIndexMap.clear();
const QList<QModelIndex> keys = mRowMap.keys();
const QList<QPersistentModelIndex> keys = mRowMap.keys();
for ( const auto &index : keys )
{
int row = mRowMap[index];
Expand Down
6 changes: 3 additions & 3 deletions src/core/layertreemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,10 @@ class FlatLayerTreeModelBase : public QAbstractProxyModel
void updateTemporalState();
void adjustTemporalStateFromAddedLayers( const QList<QgsMapLayer *> &layers );

QMap<QModelIndex, int> mRowMap;
QMap<int, QModelIndex> mIndexMap;
QMap<QPersistentModelIndex, int> mRowMap;
QMap<int, QPersistentModelIndex> mIndexMap;
QMap<int, int> mTreeLevelMap;
QList<QModelIndex> mCollapsedItems;
QList<QPersistentModelIndex> mCollapsedItems;

QgsLayerTreeModel *mLayerTreeModel = nullptr;
QString mMapTheme;
Expand Down
Loading