Skip to content
Permalink
Browse files

[styledock] Fix undo redo

  • Loading branch information
NathanW2 committed May 26, 2016
1 parent 17b4856 commit 705d4f5894a6cffa377f750de95d15f6a72370e1
Showing with 43 additions and 25 deletions.
  1. +17 −11 src/app/qgsmapstylingwidget.cpp
  2. +26 −14 src/ui/qgsmapstylingwidgetbase.ui
@@ -42,6 +42,13 @@ QgsMapStylingWidget::QgsMapStylingWidget( QgsMapCanvas* canvas, QWidget *parent

mAutoApplyTimer = new QTimer( this );
mAutoApplyTimer->setSingleShot( true );

mUndoWidget = new QgsUndoWidget( this, mMapCanvas );
mUndoWidget->setObjectName( "Undo Styles" );
mUndoWidget->hide();
connect( mUndoButton, SIGNAL( pressed() ), mUndoWidget, SLOT( undo() ) );
connect( mRedoButton, SIGNAL( pressed() ), mUndoWidget, SLOT( redo() ) );

connect( mAutoApplyTimer, SIGNAL( timeout() ), this, SLOT( apply() ) );

connect( mOptionsListWidget, SIGNAL( currentRowChanged( int ) ), this, SLOT( updateCurrentWidgetLayer() ) );
@@ -168,6 +175,8 @@ void QgsMapStylingWidget::updateCurrentWidgetLayer()

QgsMapLayer* layer = mCurrentLayer;

mUndoWidget->setUndoStack( layer->undoStackStyles() );

mLayerTitleLabel->setText( layer->name() );

if ( layer->type() == QgsMapLayer::VectorLayer )
@@ -181,6 +190,10 @@ void QgsMapStylingWidget::updateCurrentWidgetLayer()
{
mLabelingWidget = widget;
}
else if ( QgsUndoWidget* widget = qobject_cast<QgsUndoWidget*>( current ) )
{
mUndoWidget = widget;
}
else
{
current->deleteLater();
@@ -208,11 +221,6 @@ void QgsMapStylingWidget::updateCurrentWidgetLayer()
break;
}
case 2: // History
mUndoWidget = new QgsUndoWidget( mOptionsListWidget, mMapCanvas );
mUndoWidget->setObjectName( "Undo Styles" );
mUndoWidget->setUndoStack( layer->undoStackStyles() );
connect( mUndoButton, SIGNAL( pressed() ), mUndoWidget, SLOT( undo() ) );
connect( mRedoButton, SIGNAL( pressed() ), mUndoWidget, SLOT( redo() ) );
mWidgetArea->setWidget( mUndoWidget );
break;
default:
@@ -235,6 +243,10 @@ void QgsMapStylingWidget::updateCurrentWidgetLayer()
{
mRasterStyleWidget = widget;
}
else if ( QgsUndoWidget* widget = qobject_cast<QgsUndoWidget*>( current ) )
{
mUndoWidget = widget;
}
else
{
current->deleteLater();
@@ -276,12 +288,6 @@ void QgsMapStylingWidget::updateCurrentWidgetLayer()
break;
}
case 3: // History
mUndoWidget = new QgsUndoWidget( mOptionsListWidget, mMapCanvas );
mUndoWidget->setObjectName( "Undo Styles" );
mUndoWidget->setUndoStack( layer->undoStackStyles() );

connect( mUndoButton, SIGNAL( pressed() ), mUndoWidget, SLOT( undo() ) );
connect( mRedoButton, SIGNAL( pressed() ), mUndoWidget, SLOT( redo() ) );
mWidgetArea->setWidget( mUndoWidget );
break;
default:
@@ -14,13 +14,22 @@
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<property name="margin">
<property name="leftMargin">
<number>3</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<property name="bottomMargin">
<number>3</number>
</property>
<item row="0" column="0">
<widget class="QStackedWidget" name="mStackedWidget">
<property name="currentIndex">
<number>0</number>
<number>1</number>
</property>
<widget class="QWidget" name="page">
<layout class="QGridLayout" name="gridLayout_3">
@@ -35,16 +44,25 @@
</widget>
<widget class="QWidget" name="page_2">
<layout class="QGridLayout" name="gridLayout">
<property name="horizontalSpacing">
<number>3</number>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="margin">
<property name="bottomMargin">
<number>0</number>
</property>
<property name="horizontalSpacing">
<number>3</number>
</property>
<item row="2" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QToolButton" name="mRedoButton">
<widget class="QToolButton" name="mUndoButton">
<property name="text">
<string>...</string>
</property>
@@ -55,7 +73,7 @@
</widget>
</item>
<item>
<widget class="QToolButton" name="mUndoButton">
<widget class="QToolButton" name="mRedoButton">
<property name="text">
<string>...</string>
</property>
@@ -184,7 +202,7 @@
<x>0</x>
<y>0</y>
<width>320</width>
<height>388</height>
<height>401</height>
</rect>
</property>
</widget>
@@ -195,12 +213,6 @@
</widget>
</item>
</layout>
<zorder>mLayerTitleLabel</zorder>
<zorder>mLiveApplyCheck</zorder>
<zorder>mStackedWidget</zorder>
<zorder>mRedoButton</zorder>
<zorder>mUndoButton</zorder>
<zorder>mButtonBox</zorder>
</widget>
<resources>
<include location="../../images/images.qrc"/>

0 comments on commit 705d4f5

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