From 9c9dd2b4cdb38ad9bd7293a7ec481386e8122960 Mon Sep 17 00:00:00 2001 From: Matthias Kuhn Date: Mon, 8 Apr 2013 15:38:08 +0200 Subject: [PATCH] [FIX #7530] Attribute table: Edited feature not updated in single row If only a single row was shown, the outdated cached feature would be shown even when the attribute behind it was edited. --- src/gui/attributetable/qgsattributetablemodel.cpp | 6 +++++- src/gui/attributetable/qgsattributetableview.cpp | 3 --- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/gui/attributetable/qgsattributetablemodel.cpp b/src/gui/attributetable/qgsattributetablemodel.cpp index 743a28a35673..caac90f7671d 100644 --- a/src/gui/attributetable/qgsattributetablemodel.cpp +++ b/src/gui/attributetable/qgsattributetablemodel.cpp @@ -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 ); } @@ -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" ); diff --git a/src/gui/attributetable/qgsattributetableview.cpp b/src/gui/attributetable/qgsattributetableview.cpp index d6ddbdf95814..c8fa1ed24d33 100644 --- a/src/gui/attributetable/qgsattributetableview.cpp +++ b/src/gui/attributetable/qgsattributetableview.cpp @@ -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: