Skip to content

Commit

Permalink
Disable view updates while reloading attribute table
Browse files Browse the repository at this point in the history
Fix #12930
  • Loading branch information
m-kuhn committed Jun 12, 2015
1 parent 275194d commit fccd8e5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
9 changes: 3 additions & 6 deletions src/gui/attributetable/qgsattributetablemodel.cpp
Expand Up @@ -336,6 +336,7 @@ void QgsAttributeTableModel::loadAttributes()
void QgsAttributeTableModel::loadLayer()
{
QgsDebugMsg( "entered." );
beginResetModel();

if ( rowCount() != 0 )
{
Expand Down Expand Up @@ -372,6 +373,7 @@ void QgsAttributeTableModel::loadLayer()
connect( mLayerCache, SIGNAL( invalidated() ), this, SLOT( loadLayer() ) );

mFieldCount = mAttributes.size();
endResetModel();
}

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

void QgsAttributeTableModel::resetModel()
{
beginResetModel();
loadLayer();
endResetModel();
}


void QgsAttributeTableModel::executeAction( int action, const QModelIndex &idx ) const
{
Expand Down
4 changes: 3 additions & 1 deletion src/gui/attributetable/qgsattributetablemodel.h
Expand Up @@ -117,8 +117,10 @@ class GUI_EXPORT QgsAttributeTableModel: public QAbstractTableModel

/**
* Resets the model
*
* Alias to loadLayer()
*/
void resetModel();
inline void resetModel() { loadLayer(); }

/**
* Maps feature id to table row
Expand Down

0 comments on commit fccd8e5

Please sign in to comment.