add copy paste to edit menu

This commit is contained in:
garak 2021-05-03 15:47:29 -04:00
parent 47887aca4d
commit 39648eed41
2 changed files with 14 additions and 8 deletions

View file

@ -259,8 +259,11 @@ private:
QIcon* mapEditedIcon; QIcon* mapEditedIcon;
QIcon* mapOpenedIcon; QIcon* mapOpenedIcon;
QAction *undoAction; QAction *undoAction = nullptr;
QAction *redoAction; QAction *redoAction = nullptr;
QAction *copyAction = nullptr;
QAction *pasteAction = nullptr;
QWidget *eventTabObjectWidget; QWidget *eventTabObjectWidget;
QWidget *eventTabWarpWidget; QWidget *eventTabWarpWidget;

View file

@ -154,13 +154,16 @@ void MainWindow::initExtraShortcuts() {
shortcut_Open_Scripts->setObjectName("shortcut_Open_Scripts"); shortcut_Open_Scripts->setObjectName("shortcut_Open_Scripts");
shortcut_Open_Scripts->setWhatsThis("Open Map Scripts"); shortcut_Open_Scripts->setWhatsThis("Open Map Scripts");
auto *shortcut_Copy = new Shortcut(QKeySequence("Ctrl+C"), this, SLOT(copy())); copyAction = new QAction("Copy", this);
shortcut_Copy->setObjectName("shortcut_Copy"); copyAction->setShortcut(QKeySequence("Ctrl+C"));
shortcut_Copy->setWhatsThis("Copy"); connect(copyAction, &QAction::triggered, this, &MainWindow::copy);
ui->menuEdit->addSeparator();
ui->menuEdit->addAction(copyAction);
auto *shortcut_Paste = new Shortcut(QKeySequence("Ctrl+V"), this, SLOT(paste())); pasteAction = new QAction("Paste", this);
shortcut_Paste->setObjectName("shortcut_Paste"); pasteAction->setShortcut(QKeySequence("Ctrl+V"));
shortcut_Copy->setWhatsThis("Paste"); connect(pasteAction, &QAction::triggered, this, &MainWindow::paste);
ui->menuEdit->addAction(pasteAction);
} }
QObjectList MainWindow::shortcutableObjects() const { QObjectList MainWindow::shortcutableObjects() const {