@@ -66,13 +66,13 @@ void QgsAttributeTableModel::featureDeleted( int fid )
66
66
67
67
bool QgsAttributeTableModel::removeRows ( int row, int count, const QModelIndex &parent )
68
68
{
69
- QgsDebugMsgLevel ( QString ( " remove %2 rows at %1" ).arg ( row ).arg ( count ), 3 );
69
+ QgsDebugMsgLevel ( QString ( " remove %2 rows at %1 (rows %3, ids %4) " ).arg ( row ).arg ( count ). arg ( mRowIdMap . size () ). arg ( mIdRowMap . size () ), 3 );
70
70
71
71
// clean old references
72
72
for ( int i = row; i < row + count; i++ )
73
73
{
74
- mIdRowMap .remove ( mRowIdMap [ row ] );
75
- mRowIdMap .remove ( row );
74
+ mIdRowMap .remove ( mRowIdMap [ i ] );
75
+ mRowIdMap .remove ( i );
76
76
}
77
77
78
78
// update maps
@@ -86,16 +86,20 @@ bool QgsAttributeTableModel::removeRows( int row, int count, const QModelIndex &
86
86
}
87
87
88
88
#ifdef QGISDEBUG
89
- QgsDebugMsgLevel ( " id->row" , 4 );
90
89
QHash<int , int >::iterator it;
90
+
91
+ QgsDebugMsgLevel ( QString ( " after removal rows %1, ids %2" ).arg ( mRowIdMap .size () ).arg ( mIdRowMap .size () ), 4 );
92
+ QgsDebugMsgLevel ( " id->row" , 4 );
91
93
for ( it = mIdRowMap .begin (); it != mIdRowMap .end (); ++it )
92
- QgsDebugMsg ( QString ( " %1->%2" ).arg ( it.key () ).arg ( *it ) );
94
+ QgsDebugMsgLevel ( QString ( " %1->%2" ).arg ( it.key () ).arg ( *it ), 4 );
93
95
94
96
QgsDebugMsgLevel ( " row->id" , 4 );
95
97
for ( it = mRowIdMap .begin (); it != mRowIdMap .end (); ++it )
96
- QgsDebugMsg ( QString ( " %1->%2" ).arg ( it.key () ).arg ( *it ) );
98
+ QgsDebugMsgLevel ( QString ( " %1->%2" ).arg ( it.key () ).arg ( *it ), 4 );
97
99
#endif
98
100
101
+ Q_ASSERT ( mRowIdMap .size () == mIdRowMap .size () );
102
+
99
103
return true ;
100
104
}
101
105
@@ -201,14 +205,10 @@ void QgsAttributeTableModel::loadLayer()
201
205
{
202
206
QgsDebugMsg ( " entered." );
203
207
204
- Q_ASSERT ( mRowIdMap .size () == mIdRowMap .size () );
205
-
206
208
beginRemoveRows ( QModelIndex (), 0 , rowCount () - 1 );
207
209
removeRows ( 0 , rowCount () );
208
210
endRemoveRows ();
209
211
210
- Q_ASSERT ( mRowIdMap .size () == mIdRowMap .size () );
211
-
212
212
QSettings settings;
213
213
int behaviour = settings.value ( " /qgis/attributeTableBehaviour" , 0 ).toInt ();
214
214
@@ -239,8 +239,6 @@ void QgsAttributeTableModel::loadLayer()
239
239
}
240
240
}
241
241
242
- Q_ASSERT ( mRowIdMap .size () == mIdRowMap .size () );
243
-
244
242
mFieldCount = mAttributes .size ();
245
243
}
246
244
0 commit comments