Skip to content

Commit

Permalink
Move from QModelIndex to QPersistentModelIndex in the layer tree prox…
Browse files Browse the repository at this point in the history
…y model class
  • Loading branch information
nirvn committed Nov 2, 2023
1 parent a6d3f1c commit d36352e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/core/layertreemodel.cpp
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
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

1 comment on commit d36352e

@qfield-fairy
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.