mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-28 05:00:20 +00:00
Add undo stack
Add an instance of QUndoStack in the mainwindow, and add undo/redo actions in the edit menu. The QUndoStack will have a collection of QUndoCommands to process the undo and redo events. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
013da6b0af
commit
ef14798d6d
2 changed files with 13 additions and 0 deletions
|
@ -36,6 +36,7 @@
|
|||
#include "usermanual.h"
|
||||
#endif
|
||||
#include <QNetworkProxy>
|
||||
#include <QUndoStack>
|
||||
|
||||
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));
|
||||
QList<QAction*>undoRedoActions;
|
||||
undoRedoActions.append(undoAction);
|
||||
undoRedoActions.append(redoAction);
|
||||
ui.menu_Edit->addActions(undoRedoActions);
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in a new issue