Skip to content

Commit 17f0759

Browse files
committed
Added Cut/Copy/Paste controls
1 parent c40dc95 commit 17f0759

File tree

2 files changed

+27
-6
lines changed

2 files changed

+27
-6
lines changed

src/propelleride/mainwindow.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,9 @@ public slots:
8585

8686

8787
// edit
88+
void cut();
89+
void copy();
90+
void paste();
8891
void undo();
8992
void redo();
9093

src/propelleride/mainwindow/menubar.cpp

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,12 @@ void MainWindow::setupEditMenu()
6262

6363
editMenu->addSeparator();
6464

65+
editMenu->addAction(QIcon(":/icons/edit-cut.png"), tr("&Cut"), this, SLOT(cut()), QKeySequence::Cut);
66+
editMenu->addAction(QIcon(":/icons/edit-copy.png"), tr("&Copy"), this, SLOT(copy()), QKeySequence::Copy);
67+
editMenu->addAction(QIcon(":/icons/edit-paste.png"), tr("&Paste"), this, SLOT(paste()), QKeySequence::Paste);
68+
69+
editMenu->addSeparator();
70+
6571
editMenu->addAction(QIcon(":/icons/edit-find.png"), tr("Find"), this, SLOT(showFindFrame()), QKeySequence::Find);
6672
editMenu->addAction(QIcon(":/icons/go-next.png"), tr("Find Next"), this, SLOT(findNextClicked()), QKeySequence::FindNext);
6773
editMenu->addAction(QIcon(":/icons/go-previous.png"), tr("Find Previous"), this, SLOT(findPrevClicked()), QKeySequence::FindPrevious);
@@ -72,18 +78,30 @@ void MainWindow::setupEditMenu()
7278
}
7379

7480

81+
void MainWindow::cut()
82+
{
83+
getEditor(editorTabs->currentIndex())->cut();
84+
}
85+
86+
void MainWindow::copy()
87+
{
88+
getEditor(editorTabs->currentIndex())->copy();
89+
}
90+
91+
void MainWindow::paste()
92+
{
93+
getEditor(editorTabs->currentIndex())->paste();
94+
}
95+
96+
7597
void MainWindow::undo()
7698
{
77-
int index = editorTabs->currentIndex();
78-
Editor * editor = getEditor(index);
79-
editor->undo();
99+
getEditor(editorTabs->currentIndex())->undo();
80100
}
81101

82102
void MainWindow::redo()
83103
{
84-
int index = editorTabs->currentIndex();
85-
Editor * editor = getEditor(index);
86-
editor->redo();
104+
getEditor(editorTabs->currentIndex())->redo();
87105
}
88106

89107

0 commit comments

Comments
 (0)