Skip to content
Permalink
Browse files

Fix updates of undo widget in styling panel

Before, on current layer change it would switch to undo stack
of freshly activated layer, ignoring the layer set in the combo box
(and the undo stack it switched to was the one for editing)
  • Loading branch information
wonder-sk committed Jul 6, 2016
1 parent 1c91ae7 commit 3e183a27d5b127ec78e60d9d68433e5d95d392ef
Showing with 14 additions and 22 deletions.
  1. +13 −0 src/app/qgisapp.cpp
  2. +1 −18 src/app/qgsundowidget.cpp
  3. +0 −4 src/app/qgsundowidget.h
@@ -475,6 +475,19 @@ void QgisApp::activeLayerChanged( QgsMapLayer* layer )
{
if ( mMapCanvas )
mMapCanvas->setCurrentLayer( layer );

if ( mUndoWidget )
{
if ( layer )
{
mUndoWidget->setUndoStack( layer->undoStack() );
}
else
{
mUndoWidget->destroyStack();
}
updateUndoActions();
}
}

/**
@@ -14,9 +14,8 @@
***************************************************************************/
#include "qgsundowidget.h"

#include "qgisapp.h"
#include "qgsapplication.h"
#include "qgslayertreeview.h"
#include "qgslogger.h"
#include "qgsmaplayer.h"
#include "qgsmapcanvas.h"

@@ -28,8 +27,6 @@ QgsUndoWidget::QgsUndoWidget( QWidget * parent, QgsMapCanvas * mapCanvas )

connect( undoButton, SIGNAL( clicked() ), this, SLOT( undo() ) );
connect( redoButton, SIGNAL( clicked() ), this, SLOT( redo() ) );
connect( QgisApp::instance()->layerTreeView(), SIGNAL( currentLayerChanged( QgsMapLayer* ) ),
this, SLOT( layerChanged( QgsMapLayer* ) ) );

undoButton->setDisabled( true );
redoButton->setDisabled( true );
@@ -42,20 +39,6 @@ QgsUndoWidget::QgsUndoWidget( QWidget * parent, QgsMapCanvas * mapCanvas )
}


void QgsUndoWidget::layerChanged( QgsMapLayer * layer )
{
if ( layer )
{
setUndoStack( layer->undoStack() );
}
else
{
destroyStack();
}
emit undoStackChanged();
}


void QgsUndoWidget::destroyStack()
{
if ( mUndoStack )
@@ -64,10 +64,6 @@ class APP_EXPORT QgsUndoWidget : public QgsPanelWidget
QWidget* dockContents() { return dockWidgetContents; }

public slots:
/**
* Changes undo stack which is displayed by undo view
*/
void layerChanged( QgsMapLayer * layer );

/**
* Slot to handle undo changed signal

0 comments on commit 3e183a2

Please sign in to comment.
You can’t perform that action at this time.