Skip to content

Commit

Permalink
[attrtable] Dismiss cached data when column is removed (Fix #8405)
Browse files Browse the repository at this point in the history
  • Loading branch information
m-kuhn committed Aug 8, 2013
1 parent a2a4418 commit 16f2411
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/gui/attributetable/qgsattributetablemodel.cpp
Expand Up @@ -53,6 +53,7 @@ QgsAttributeTableModel::QgsAttributeTableModel( QgsVectorLayerCache *layerCache,
connect( layer(), SIGNAL( attributeValueChanged( QgsFeatureId, int, const QVariant& ) ), this, SLOT( attributeValueChanged( QgsFeatureId, int, const QVariant& ) ) );
connect( layer(), SIGNAL( featureAdded( QgsFeatureId ) ), this, SLOT( featureAdded( QgsFeatureId ) ) );
connect( layer(), SIGNAL( featureDeleted( QgsFeatureId ) ), this, SLOT( featureDeleted( QgsFeatureId ) ) );
connect( layer(), SIGNAL( attributeDeleted( int ) ), this, SLOT( attributeDeleted( int ) ) );
connect( layer(), SIGNAL( updatedFields() ), this, SLOT( updatedFields() ) );
connect( mLayerCache, SIGNAL( cachedLayerDeleted() ), this, SLOT( layerDeleted() ) );
}
Expand Down Expand Up @@ -148,6 +149,14 @@ void QgsAttributeTableModel::updatedFields()
emit modelChanged();
}

void QgsAttributeTableModel::attributeDeleted( int idx )
{
if ( idx == mCachedField )
{
prefetchColumnData( -1 );
}
}

void QgsAttributeTableModel::layerDeleted()
{
QgsDebugMsg( "entered." );
Expand Down
5 changes: 5 additions & 0 deletions src/gui/attributetable/qgsattributetablemodel.h
Expand Up @@ -204,6 +204,11 @@ class GUI_EXPORT QgsAttributeTableModel: public QAbstractTableModel
*/
virtual void updatedFields();

/**
* Called whenever a column is removed;
*/
virtual void attributeDeleted( int idx );

protected slots:
/**
* Launched when attribute value has been changed
Expand Down

0 comments on commit 16f2411

Please sign in to comment.