Skip to content

Commit

Permalink
Fix undo/redo for rule-based renderer/labeling in styling dock
Browse files Browse the repository at this point in the history
  • Loading branch information
wonder-sk committed Jul 6, 2016
1 parent 156e7e0 commit d37518d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
9 changes: 4 additions & 5 deletions src/app/qgsrulebasedlabelingwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ QgsRuleBasedLabelingWidget::QgsRuleBasedLabelingWidget( QgsVectorLayer* layer, Q

mModel = new QgsRuleBasedLabelingModel( mRootRule );
viewRules->setModel( mModel );

connect( mModel, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SIGNAL( widgetChanged() ) );
connect( mModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SIGNAL( widgetChanged() ) );
connect( mModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SIGNAL( widgetChanged() ) );
}

QgsRuleBasedLabelingWidget::~QgsRuleBasedLabelingWidget()
Expand Down Expand Up @@ -116,8 +120,6 @@ void QgsRuleBasedLabelingWidget::ruleWidgetPanelAccepted( QgsPanelWidget* panel

QModelIndex index = viewRules->selectionModel()->currentIndex();
mModel->updateRule( index.parent(), index.row() );

emit widgetChanged();
}

void QgsRuleBasedLabelingWidget::liveUpdateRuleFromPanel()
Expand Down Expand Up @@ -158,7 +160,6 @@ void QgsRuleBasedLabelingWidget::removeRule()
}
// make sure that the selection is gone
viewRules->selectionModel()->clear();
emit widgetChanged();
}

void QgsRuleBasedLabelingWidget::copy()
Expand All @@ -171,7 +172,6 @@ void QgsRuleBasedLabelingWidget::copy()

QMimeData* mime = mModel->mimeData( indexlist );
QApplication::clipboard()->setMimeData( mime );
emit widgetChanged();
}

void QgsRuleBasedLabelingWidget::paste()
Expand All @@ -184,7 +184,6 @@ void QgsRuleBasedLabelingWidget::paste()
else
index = indexlist.first();
mModel->dropMimeData( mime, Qt::CopyAction, index.row(), index.column(), index.parent() );
emit widgetChanged();
}

QgsRuleBasedLabeling::Rule* QgsRuleBasedLabelingWidget::currentRule()
Expand Down
5 changes: 2 additions & 3 deletions src/gui/symbology-ng/qgsrulebasedrendererv2widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ QgsRuleBasedRendererV2Widget::QgsRuleBasedRendererV2Widget( QgsVectorLayer* laye
connect( btnRenderingOrder, SIGNAL( clicked() ), this, SLOT( setRenderingOrder() ) );

connect( mModel, SIGNAL( dataChanged( QModelIndex, QModelIndex ) ), this, SIGNAL( widgetChanged() ) );
connect( mModel, SIGNAL( rowsInserted( QModelIndex, int, int ) ), this, SIGNAL( widgetChanged() ) );
connect( mModel, SIGNAL( rowsRemoved( QModelIndex, int, int ) ), this, SIGNAL( widgetChanged() ) );

currentRuleChanged();
selectedRulesChanged();
Expand Down Expand Up @@ -462,7 +464,6 @@ void QgsRuleBasedRendererV2Widget::refineRuleCategoriesAccepted( QgsPanelWidget
QgsRuleBasedRendererV2::refineRuleCategories( initialRule, r );
}
mModel->finishedAddingRules();
emit widgetChanged();
}

void QgsRuleBasedRendererV2Widget::refineRuleRangesAccepted( QgsPanelWidget *panel )
Expand All @@ -478,7 +479,6 @@ void QgsRuleBasedRendererV2Widget::refineRuleRangesAccepted( QgsPanelWidget *pan
QgsRuleBasedRendererV2::refineRuleRanges( initialRule, r );
}
mModel->finishedAddingRules();
emit widgetChanged();
}

void QgsRuleBasedRendererV2Widget::ruleWidgetPanelAccepted( QgsPanelWidget *panel )
Expand All @@ -490,7 +490,6 @@ void QgsRuleBasedRendererV2Widget::ruleWidgetPanelAccepted( QgsPanelWidget *pane
QModelIndex index = viewRules->selectionModel()->currentIndex();
mModel->updateRule( index.parent(), index.row() );
mModel->clearFeatureCounts();
emit widgetChanged();
}

void QgsRuleBasedRendererV2Widget::liveUpdateRuleFromPanel()
Expand Down

0 comments on commit d37518d

Please sign in to comment.