summaryrefslogtreecommitdiff
path: root/src/gui/undocommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/undocommands.cpp')
-rw-r--r--src/gui/undocommands.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/gui/undocommands.cpp b/src/gui/undocommands.cpp
index f64b1db..32fafbe 100644
--- a/src/gui/undocommands.cpp
+++ b/src/gui/undocommands.cpp
@@ -328,3 +328,26 @@ void PasteCommand::redo()
GraphUpdateCommand::redo();
}
+
+ChangeLabelCommand::ChangeLabelCommand(TikzScene *scene, Graph *graph, QMap<Node *, QString> oldLabels, QString newLabel, QUndoCommand *parent) :
+ GraphUpdateCommand(scene, parent), _oldLabels(oldLabels), _newLabel(newLabel)
+{
+}
+
+void ChangeLabelCommand::undo()
+{
+ foreach (Node *n, _oldLabels.keys()) {
+ n->setLabel(_oldLabels[n]);
+ }
+
+ GraphUpdateCommand::undo();
+}
+
+void ChangeLabelCommand::redo()
+{
+ foreach (Node *n, _oldLabels.keys()) {
+ n->setLabel(_newLabel);
+ }
+
+ GraphUpdateCommand::redo();
+}