Skip to content

Commit

Permalink
macOS: fix key events #324
Browse files Browse the repository at this point in the history
  • Loading branch information
rodlie committed Dec 10, 2024
1 parent d23914e commit 646ea6b
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/app/GUI/canvaswindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,9 @@ bool CanvasWindow::KFT_keyReleaseEvent(QKeyEvent *event)

bool CanvasWindow::KFT_keyPressEvent(QKeyEvent *event)
{
#ifdef Q_OS_MAC
if (event->type() == QEvent::ShortcutOverride) { return false; }
#endif
if (!mCurrentCanvas) { return false; }
if (mCurrentCanvas->isPreviewingOrRendering()) { return false; }
const QPoint globalPos = QCursor::pos();
Expand Down
6 changes: 5 additions & 1 deletion src/app/GUI/keysview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,11 @@ stdsptr<KeysClipboard> KeysView::getSelectedKeysClipboardContainer() {
return container;
}

bool KeysView::KFT_keyPressEvent(QKeyEvent *event) {
bool KeysView::KFT_keyPressEvent(QKeyEvent *event)
{
#ifdef Q_OS_MAC
if (event->type() == QEvent::ShortcutOverride) { return false; }
#endif
bool inputHandled = false;
if(mMovingKeys) {
if(mValueInput.handleTransormationInputKeyEvent(event->key())) {
Expand Down
4 changes: 4 additions & 0 deletions src/app/GUI/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -574,7 +574,9 @@ void MainWindow::setupMenuBar()
const auto qAct = new NoShortcutAction(tr("Duplicate", "MenuBar_Edit"));
mEditMenu->addAction(qAct);
qAct->setIcon(QIcon::fromTheme("duplicate"));
#ifndef Q_OS_MAC
qAct->setShortcut(Qt::CTRL + Qt::Key_D);
#endif
mActions.duplicateAction->connect(qAct);
cmdAddAction(qAct);
}
Expand All @@ -583,7 +585,9 @@ void MainWindow::setupMenuBar()
const auto qAct = new NoShortcutAction(tr("Delete", "MenuBar_Edit"));
qAct->setIcon(QIcon::fromTheme("trash"));
mEditMenu->addAction(qAct);
#ifndef Q_OS_MAC
qAct->setShortcut(Qt::Key_Delete);
#endif
mActions.deleteAction->connect(qAct);
cmdAddAction(qAct);
}
Expand Down

0 comments on commit 646ea6b

Please sign in to comment.