summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar Dirk Hohndel <dirk@hohndel.org>2020-01-11 15:22:50 -0800
committerGravatar Dirk Hohndel <dirk@hohndel.org>2020-03-10 09:25:57 -0700
commit41072cf48f59b67391bac637002ca4a4c224eff6 (patch)
treeadccb23aae83777e58c9d5fd11b2950c4695f4b3
parent2936d203e22058b8816fd54070b4b14dc6a362fb (diff)
downloadsubsurface-41072cf48f59b67391bac637002ca4a4c224eff6.tar.gz
core/undo: provide access to the QUndoStack
This is used by the mobile UI to get notifications when the undo text changes. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
-rw-r--r--commands/command_base.cpp6
-rw-r--r--commands/command_base.h2
2 files changed, 8 insertions, 0 deletions
diff --git a/commands/command_base.cpp b/commands/command_base.cpp
index edfc97bf3..20147a541 100644
--- a/commands/command_base.cpp
+++ b/commands/command_base.cpp
@@ -29,6 +29,12 @@ bool isClean()
return undoStack.isClean();
}
+// this can be used to get access to the signals emitted by the QUndoStack
+QUndoStack *getUndoStack()
+{
+ return &undoStack;
+}
+
QAction *undoAction(QObject *parent)
{
return undoStack.createUndoAction(parent, QCoreApplication::translate("Command", "&Undo"));
diff --git a/commands/command_base.h b/commands/command_base.h
index 9a2f6cf34..59c3cd412 100644
--- a/commands/command_base.h
+++ b/commands/command_base.h
@@ -172,6 +172,8 @@ public:
// If nothing is to be done, the command will be deleted and false is returned.
bool execute(Base *cmd);
+QUndoStack *getUndoStack();
+
} // namespace Command
#endif // COMMAND_BASE_H