@@ -75,7 +75,8 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
75
75
76
76
QgsDebugMsg ( QStringLiteral ( " Index count: %1" ).arg ( selection.indexes ().size () ) );
77
77
78
- Q_FOREACH ( const QModelIndex &index , selection.indexes () )
78
+ const auto constIndexes = selection.indexes ();
79
+ for ( const QModelIndex &index : constIndexes )
79
80
{
80
81
QgsFeatureId id = index .model ()->data ( index , QgsAttributeTableModel::FeatureIdRole ).toLongLong ();
81
82
@@ -89,7 +90,8 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
89
90
if ( !mSyncEnabled )
90
91
{
91
92
mClearAndSelectBuffer = true ;
92
- Q_FOREACH ( QgsFeatureId id, ids )
93
+ const auto constIds = ids;
94
+ for ( QgsFeatureId id : constIds )
93
95
{
94
96
if ( !mDeselectedBuffer .remove ( id ) )
95
97
{
@@ -106,7 +108,8 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
106
108
{
107
109
if ( !mSyncEnabled )
108
110
{
109
- Q_FOREACH ( QgsFeatureId id, ids )
111
+ const auto constIds = ids;
112
+ for ( QgsFeatureId id : constIds )
110
113
{
111
114
if ( !mDeselectedBuffer .remove ( id ) )
112
115
{
@@ -123,7 +126,8 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
123
126
{
124
127
if ( !mSyncEnabled )
125
128
{
126
- Q_FOREACH ( QgsFeatureId id, ids )
129
+ const auto constIds = ids;
130
+ for ( QgsFeatureId id : constIds )
127
131
{
128
132
if ( !mSelectedBuffer .remove ( id ) )
129
133
{
@@ -140,7 +144,8 @@ void QgsFeatureSelectionModel::selectFeatures( const QItemSelection &selection,
140
144
connect ( mFeatureSelectionManager , &QgsIFeatureSelectionManager::selectionChanged, this , &QgsFeatureSelectionModel::layerSelectionChanged );
141
145
142
146
QModelIndexList updatedIndexes;
143
- Q_FOREACH ( const QModelIndex &idx, selection.indexes () )
147
+ const auto indexes = selection.indexes ();
148
+ for ( const QModelIndex &idx : indexes )
144
149
{
145
150
updatedIndexes.append ( expandIndexToRow ( idx ) );
146
151
}
@@ -164,12 +169,14 @@ void QgsFeatureSelectionModel::layerSelectionChanged( const QgsFeatureIds &selec
164
169
else
165
170
{
166
171
QModelIndexList updatedIndexes;
167
- Q_FOREACH ( QgsFeatureId fid, selected )
172
+ const auto constSelected = selected;
173
+ for ( QgsFeatureId fid : constSelected )
168
174
{
169
175
updatedIndexes.append ( expandIndexToRow ( mFeatureModel ->fidToIndex ( fid ) ) );
170
176
}
171
177
172
- Q_FOREACH ( QgsFeatureId fid, deselected )
178
+ const auto constDeselected = deselected;
179
+ for ( QgsFeatureId fid : constDeselected )
173
180
{
174
181
updatedIndexes.append ( expandIndexToRow ( mFeatureModel ->fidToIndex ( fid ) ) );
175
182
}
0 commit comments