Skip to content

Commit fccd8e5

Browse files
committedJun 12, 2015
Disable view updates while reloading attribute table
Fix #12930
1 parent 275194d commit fccd8e5

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed
 

‎src/gui/attributetable/qgsattributetablemodel.cpp

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,6 +336,7 @@ void QgsAttributeTableModel::loadAttributes()
336336
void QgsAttributeTableModel::loadLayer()
337337
{
338338
QgsDebugMsg( "entered." );
339+
beginResetModel();
339340

340341
if ( rowCount() != 0 )
341342
{
@@ -372,6 +373,7 @@ void QgsAttributeTableModel::loadLayer()
372373
connect( mLayerCache, SIGNAL( invalidated() ), this, SLOT( loadLayer() ) );
373374

374375
mFieldCount = mAttributes.size();
376+
endResetModel();
375377
}
376378

377379
void QgsAttributeTableModel::swapRows( QgsFeatureId a, QgsFeatureId b )
@@ -620,12 +622,7 @@ void QgsAttributeTableModel::reload( const QModelIndex &index1, const QModelInde
620622
emit dataChanged( index1, index2 );
621623
}
622624

623-
void QgsAttributeTableModel::resetModel()
624-
{
625-
beginResetModel();
626-
loadLayer();
627-
endResetModel();
628-
}
625+
629626

630627
void QgsAttributeTableModel::executeAction( int action, const QModelIndex &idx ) const
631628
{

‎src/gui/attributetable/qgsattributetablemodel.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,10 @@ class GUI_EXPORT QgsAttributeTableModel: public QAbstractTableModel
117117

118118
/**
119119
* Resets the model
120+
*
121+
* Alias to loadLayer()
120122
*/
121-
void resetModel();
123+
inline void resetModel() { loadLayer(); }
122124

123125
/**
124126
* Maps feature id to table row

0 commit comments

Comments
 (0)
Please sign in to comment.