Merge pull request #8524 from signedav/editafteredit

[Bugfix] Release cell from focus on editing off
This commit is contained in:
Alessandro Pasotti 2018-11-22 13:43:58 +01:00 committed by GitHub
commit b6d9e0ba49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -875,6 +875,12 @@ void QgsAttributeTableDialog::mActionToggleEditing_toggled( bool )
{
if ( !mLayer )
return;
//this has to be done, because in case only one cell has been changed and is still enabled, the change
//would not be added to the mEditBuffer. By disabling, it looses focus and the change will be stored.
if ( mLayer->isEditable() && mMainView->tableView()->indexWidget( mMainView->tableView()->currentIndex() ) )
mMainView->tableView()->indexWidget( mMainView->tableView()->currentIndex() )->setEnabled( false );
if ( !QgisApp::instance()->toggleEditing( mLayer ) )
{
// restore gui state if toggling was canceled or layer commit/rollback failed