Skip to content

Commit 3e183a2

Browse files
committedJul 6, 2016
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)
1 parent 1c91ae7 commit 3e183a2

File tree

3 files changed

+14
-22
lines changed

3 files changed

+14
-22
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,19 @@ void QgisApp::activeLayerChanged( QgsMapLayer* layer )
475475
{
476476
if ( mMapCanvas )
477477
mMapCanvas->setCurrentLayer( layer );
478+
479+
if ( mUndoWidget )
480+
{
481+
if ( layer )
482+
{
483+
mUndoWidget->setUndoStack( layer->undoStack() );
484+
}
485+
else
486+
{
487+
mUndoWidget->destroyStack();
488+
}
489+
updateUndoActions();
490+
}
478491
}
479492

480493
/**

‎src/app/qgsundowidget.cpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,8 @@
1414
***************************************************************************/
1515
#include "qgsundowidget.h"
1616

17-
#include "qgisapp.h"
1817
#include "qgsapplication.h"
19-
#include "qgslayertreeview.h"
18+
#include "qgslogger.h"
2019
#include "qgsmaplayer.h"
2120
#include "qgsmapcanvas.h"
2221

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

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

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

4441

45-
void QgsUndoWidget::layerChanged( QgsMapLayer * layer )
46-
{
47-
if ( layer )
48-
{
49-
setUndoStack( layer->undoStack() );
50-
}
51-
else
52-
{
53-
destroyStack();
54-
}
55-
emit undoStackChanged();
56-
}
57-
58-
5942
void QgsUndoWidget::destroyStack()
6043
{
6144
if ( mUndoStack )

‎src/app/qgsundowidget.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,6 @@ class APP_EXPORT QgsUndoWidget : public QgsPanelWidget
6464
QWidget* dockContents() { return dockWidgetContents; }
6565

6666
public slots:
67-
/**
68-
* Changes undo stack which is displayed by undo view
69-
*/
70-
void layerChanged( QgsMapLayer * layer );
7167

7268
/**
7369
* Slot to handle undo changed signal

0 commit comments

Comments
 (0)
Please sign in to comment.