mirror of
https://github.com/qgis/QGIS.git
synced 2025-02-28 00:17:30 -05:00
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)
This commit is contained in:
parent
1c91ae7733
commit
3e183a27d5
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user