summaryrefslogtreecommitdiff
path: root/src/gui/undocommands.cpp
diff options
context:
space:
mode:
authorAleks Kissinger <aleks0@gmail.com>2018-04-05 15:07:57 +0200
committerAleks Kissinger <aleks0@gmail.com>2018-04-05 15:07:57 +0200
commit9e2116497660509afd417cc3b952ea80bbb72ce5 (patch)
tree040d4bed1ec5891d2eccaaeb42c7e12935263b07 /src/gui/undocommands.cpp
parente57923c7d767f5a532bc35571d74a5470eb76314 (diff)
can now edit node labels
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();
+}