Retrieve QUndoStack pointer from core and create actions for undo and redo.
This commit is contained in:
@ -3,6 +3,7 @@
|
||||
|
||||
#include <QCloseEvent>
|
||||
#include <QMessageBox>
|
||||
#include <QUndoStack>
|
||||
|
||||
#include "../../ApplicationConfig.h"
|
||||
#include "data/settingshandler.h"
|
||||
@ -196,6 +197,20 @@ void MainWindow::createFileActions() {
|
||||
}
|
||||
|
||||
void MainWindow::createEditActions() {
|
||||
m_modelUndoStack = m_core->getModUndoStack();
|
||||
|
||||
connect(m_modelUndoStack.get(), SIGNAL(cleanChanged(bool)), this,
|
||||
SLOT(onCleanStateChanged(bool)));
|
||||
m_undoAct.reset(m_modelUndoStack->createUndoAction(this, tr("&Undo")));
|
||||
m_undoAct->setShortcuts(QKeySequence::Undo);
|
||||
m_undoAct->setStatusTip(tr("Undo the last operation"));
|
||||
ui->menu_Edit->addAction(m_undoAct.get());
|
||||
|
||||
m_redoAct.reset(m_modelUndoStack->createRedoAction(this, tr("&Redo")));
|
||||
m_redoAct->setShortcuts(QKeySequence::Redo);
|
||||
m_redoAct->setStatusTip(tr("Redo the last operation"));
|
||||
ui->menu_Edit->addAction(m_redoAct.get());
|
||||
|
||||
m_cutAct = make_unique<QAction>(tr("Cu&t"), this);
|
||||
m_cutAct->setShortcuts(QKeySequence::Cut);
|
||||
m_cutAct->setStatusTip(
|
||||
|
||||
@ -7,6 +7,7 @@ QT_BEGIN_NAMESPACE
|
||||
|
||||
class QAbstractItemModel;
|
||||
|
||||
class QUndoStack;
|
||||
namespace Ui {
|
||||
class MainWindow;
|
||||
}
|
||||
@ -43,6 +44,7 @@ class MainWindow : public QMainWindow {
|
||||
// GenericCore* m_core;
|
||||
unique_ptr<GenericCore> m_core;
|
||||
shared_ptr<QAbstractItemModel> m_tableModel;
|
||||
shared_ptr<QUndoStack> m_modelUndoStack;
|
||||
|
||||
/// File actions
|
||||
unique_ptr<QAction> m_newFileAct;
|
||||
|
||||
Reference in New Issue
Block a user