diff --git a/qt-ui/mainwindow.cpp b/qt-ui/mainwindow.cpp index 9908e2402..a0e4f128d 100644 --- a/qt-ui/mainwindow.cpp +++ b/qt-ui/mainwindow.cpp @@ -36,6 +36,7 @@ #include "usermanual.h" #endif #include +#include MainWindow *MainWindow::m_Instance = NULL; @@ -180,6 +181,16 @@ MainWindow::MainWindow() : QMainWindow(), toolBar->setContentsMargins(zeroMargins); updateManager = new UpdateManager(this); + + undoStack = new QUndoStack(this); + QAction *undoAction = undoStack->createUndoAction(this, tr("&Undo")); + QAction *redoAction = undoStack->createRedoAction(this, tr("&Redo")); + undoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z)); + redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z)); + QListundoRedoActions; + undoRedoActions.append(undoAction); + undoRedoActions.append(redoAction); + ui.menu_Edit->addActions(undoRedoActions); } MainWindow::~MainWindow() diff --git a/qt-ui/mainwindow.h b/qt-ui/mainwindow.h index 5ee085c29..25771d650 100644 --- a/qt-ui/mainwindow.h +++ b/qt-ui/mainwindow.h @@ -34,6 +34,7 @@ class DivePlannerWidget; class ProfileWidget2; class PlannerDetails; class PlannerSettingsWidget; +class QUndoStack; enum MainWindowTitleFormat { MWTF_DEFAULT, @@ -88,6 +89,7 @@ public: void printPlan(); void checkSurvey(QSettings *s); void setApplicationState(const QByteArray& state); + QUndoStack *undoStack; private slots: /* file menu action */