Disable view updates while reloading attribute table

Fix #12930
This commit is contained in:
Matthias Kuhn 2015-06-11 16:19:26 +02:00
parent 275194dbd5
commit fccd8e58cd
2 changed files with 6 additions and 7 deletions

View File

@ -336,6 +336,7 @@ void QgsAttributeTableModel::loadAttributes()
void QgsAttributeTableModel::loadLayer()
{
QgsDebugMsg( "entered." );
beginResetModel();
if ( rowCount() != 0 )
{
@ -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 )
@ -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
{

View File

@ -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