Skip to content

Commit

Permalink
macOS: fix copy/paste etc
Browse files Browse the repository at this point in the history
Ref: #324
  • Loading branch information
rodlie committed Nov 30, 2024
1 parent 3a114db commit fdb4455
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/app/GUI/canvaswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,9 @@ void CanvasWindow::writeStateXEV(QDomElement& ele,

bool CanvasWindow::handleCutCopyPasteKeyPress(QKeyEvent *event)
{
#ifdef Q_OS_MAC
if (event->type() == QEvent::ShortcutOverride) { return false; }
#endif
if (event->modifiers() & Qt::ControlModifier &&
event->key() == Qt::Key_V) {
if (event->isAutoRepeat()) { return false; }
Expand Down
6 changes: 6 additions & 0 deletions src/app/GUI/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -539,7 +539,9 @@ void MainWindow::setupMenuBar()
const auto qAct = new NoShortcutAction(tr("Copy", "MenuBar_Edit"));
qAct->setIcon(QIcon::fromTheme("copy"));
mEditMenu->addAction(qAct);
#ifndef Q_OS_MAC
qAct->setShortcut(Qt::CTRL + Qt::Key_C);
#endif
mActions.copyAction->connect(qAct);
cmdAddAction(qAct);
}
Expand All @@ -548,7 +550,9 @@ void MainWindow::setupMenuBar()
const auto qAct = new NoShortcutAction(tr("Cut", "MenuBar_Edit"));
qAct->setIcon(QIcon::fromTheme("cut"));
mEditMenu->addAction(qAct);
#ifndef Q_OS_MAC
qAct->setShortcut(Qt::CTRL + Qt::Key_X);
#endif
mActions.cutAction->connect(qAct);
cmdAddAction(qAct);
}
Expand All @@ -557,7 +561,9 @@ void MainWindow::setupMenuBar()
const auto qAct = new NoShortcutAction(tr("Paste", "MenuBar_Edit"));
qAct->setIcon(QIcon::fromTheme("paste"));
mEditMenu->addAction(qAct);
#ifndef Q_OS_MAC
qAct->setShortcut(Qt::CTRL + Qt::Key_V);
#endif
mActions.pasteAction->connect(qAct);
cmdAddAction(qAct);
}
Expand Down

0 comments on commit fdb4455

Please sign in to comment.