mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-25 00:58:06 -05:00
Update vector layer edits rollback method and app rollback actions
- Make optional whether edit buffer is deleted - Returns optional functionality where rollback was similar to setting undo stack to index 0
This commit is contained in:
parent
ba2082ef86
commit
8feb84af46
@ -5449,7 +5449,7 @@ void QgisApp::cancelEdits( QgsMapLayer *layer, bool leaveEditable, bool triggerR
|
||||
mSaveRollbackInProgress = true;
|
||||
|
||||
mMapCanvas->freeze( true );
|
||||
if ( !vlayer->rollBack() )
|
||||
if ( !vlayer->rollBack( !leaveEditable ) )
|
||||
{
|
||||
mSaveRollbackInProgress = false;
|
||||
QMessageBox::information( 0,
|
||||
|
@ -3326,7 +3326,7 @@ const QStringList &QgsVectorLayer::commitErrors()
|
||||
return mCommitErrors;
|
||||
}
|
||||
|
||||
bool QgsVectorLayer::rollBack()
|
||||
bool QgsVectorLayer::rollBack( bool deleteBuffer )
|
||||
{
|
||||
if ( !mEditBuffer )
|
||||
{
|
||||
@ -3344,8 +3344,12 @@ bool QgsVectorLayer::rollBack()
|
||||
|
||||
updateFields();
|
||||
|
||||
delete mEditBuffer;
|
||||
mEditBuffer = 0;
|
||||
if ( deleteBuffer )
|
||||
{
|
||||
delete mEditBuffer;
|
||||
mEditBuffer = 0;
|
||||
undoStack()->clear();
|
||||
}
|
||||
emit editingStopped();
|
||||
|
||||
// invalidate the cache so the layer updates properly to show its original
|
||||
|
@ -713,8 +713,10 @@ class CORE_EXPORT QgsVectorLayer : public QgsMapLayer
|
||||
bool commitChanges();
|
||||
const QStringList &commitErrors();
|
||||
|
||||
/** Stop editing and discard the edits */
|
||||
bool rollBack();
|
||||
/** Stop editing and discard the edits
|
||||
* @param deleteBuffer whether to delete editing buffer (added in 1.9)
|
||||
*/
|
||||
bool rollBack( bool deleteBuffer = true );
|
||||
|
||||
/**get edit type*/
|
||||
EditType editType( int idx );
|
||||
|
Loading…
x
Reference in New Issue
Block a user