From e08fe1cc8f11da28b004a0b356478ca514d1d4f9 Mon Sep 17 00:00:00 2001 From: Denis Rouzaud Date: Wed, 9 Oct 2019 15:18:11 +0200 Subject: [PATCH] prevent clearing selection in QgsFeatureListView this removes warning in debug mode about invalid model currently, the unselection is not used in the dual view and the signal (currentEditSelectionChanged) is only emitted when the selection count is 1 (so never emitted when clearing the selection) it might makes sense to implement a clear selection in the feature list view but it has to emit proper signals and the dual view must be adapted to clear the form on the right --- src/gui/attributetable/qgsfeaturelistview.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/gui/attributetable/qgsfeaturelistview.cpp b/src/gui/attributetable/qgsfeaturelistview.cpp index b5030df1888..8e7800bbfc9 100644 --- a/src/gui/attributetable/qgsfeaturelistview.cpp +++ b/src/gui/attributetable/qgsfeaturelistview.cpp @@ -135,8 +135,10 @@ void QgsFeatureListView::mousePressEvent( QMouseEvent *event ) if ( QgsFeatureListViewDelegate::EditElement == mItemDelegate->positionToElement( event->pos() ) ) { + mEditSelectionDrag = true; - setEditSelection( mModel->mapToMaster( index ), QItemSelectionModel::ClearAndSelect ); + if ( index.isValid() ) + setEditSelection( mModel->mapToMaster( index ), QItemSelectionModel::ClearAndSelect ); } else { @@ -236,7 +238,8 @@ void QgsFeatureListView::mouseMoveEvent( QMouseEvent *event ) if ( mEditSelectionDrag ) { - setEditSelection( mModel->mapToMaster( index ), QItemSelectionModel::ClearAndSelect ); + if ( index.isValid() ) + setEditSelection( mModel->mapToMaster( index ), QItemSelectionModel::ClearAndSelect ); } else {