Skip to content

Commit

Permalink
[FIX #7530] Attribute table: Edited feature not updated in single row
Browse files Browse the repository at this point in the history
If only a single row was shown, the outdated cached feature would be shown even
when the attribute behind it was edited.
  • Loading branch information
m-kuhn committed Apr 8, 2013
1 parent 663e95d commit 9c9dd2b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
6 changes: 5 additions & 1 deletion src/gui/attributetable/qgsattributetablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,10 @@ void QgsAttributeTableModel::layerDeleted()

void QgsAttributeTableModel::attributeValueChanged( QgsFeatureId fid, int idx, const QVariant &value )
{
if ( fid == mFeat.id() )
{
mFeat.setValid( false );
}
setData( index( idToRow( fid ), fieldCol( idx ) ), value, Qt::EditRole );
}

Expand Down Expand Up @@ -469,7 +473,7 @@ QVariant QgsAttributeTableModel::data( const QModelIndex &index, int role ) cons
}

// if we don't have the row in current cache, load it from layer first
if ( mFeat.id() != rowId )
if ( mFeat.id() != rowId || !mFeat.isValid() )
{
if ( !loadFeatureAtId( rowId ) )
return QVariant( "ERROR" );
Expand Down
3 changes: 0 additions & 3 deletions src/gui/attributetable/qgsattributetableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,6 @@ bool QgsAttributeTableView::eventFilter(QObject *object, QEvent *event)
{
if ( object == verticalHeader()->viewport() )
{

qDebug() << "Event " << event->type();

switch ( event->type() )
{
case QEvent::MouseButtonPress:
Expand Down

0 comments on commit 9c9dd2b

Please sign in to comment.