From 70248093ef4088322729a2ee61020b5070f132e7 Mon Sep 17 00:00:00 2001 From: Ishaan Malhotra Date: Wed, 23 Apr 2025 20:16:22 -0400 Subject: [PATCH 1/3] First draft of Issue 186 Fix --- docs/keyboard_shortcuts.md | 3 +++ src/listviewlogic.cpp | 6 ++++++ src/mainwindow.cpp | 12 ++++++++++-- 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/docs/keyboard_shortcuts.md b/docs/keyboard_shortcuts.md index 7f3a4abd..e17584f8 100644 --- a/docs/keyboard_shortcuts.md +++ b/docs/keyboard_shortcuts.md @@ -24,7 +24,10 @@ These shortcuts are meant to be used while the Notes window is currently focused | Ctrl + E | Clear the search bar | | Ctrl + (or just ) | Select note below | | Ctrl + (or just ) | Select note above | +| Command + (macOS) | Select note below | +| Command + (macOS) | Select note above | | Ctrl + Enter | Focus on the text editor | +| Command + L (macOS) | Focus on the text editor | | Ctrl + Shift + F | Toggle full screen mode | | Ctrl + Shift + K | Toggle kanban view | | F11 | Toggle full screen mode | diff --git a/src/listviewlogic.cpp b/src/listviewlogic.cpp index d7fec348..7a8c4481 100644 --- a/src/listviewlogic.cpp +++ b/src/listviewlogic.cpp @@ -189,6 +189,9 @@ void ListViewLogic::deleteNoteRequested(const NodeData ¬e) void ListViewLogic::selectNoteUp() { + // Ensure the list view has focus + m_listView->setFocus(); + auto currentIndex = m_listView->currentIndex(); if (currentIndex.isValid()) { int currentRow = currentIndex.row(); @@ -209,6 +212,9 @@ void ListViewLogic::selectNoteUp() void ListViewLogic::selectNoteDown() { + // Ensure the list view has focus + m_listView->setFocus(); + auto currentIndex = m_listView->currentIndex(); if (currentIndex.isValid()) { int currentRow = currentIndex.row(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 4c33b7c3..e0c25de4 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -532,14 +532,22 @@ void MainWindow::setupKeyboardShortcuts() new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_D), this, SLOT(deleteSelectedNote())); new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F), m_searchEdit, SLOT(setFocus())); new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_E), m_searchEdit, SLOT(clear())); + + // Add macOS-specific shortcuts for note navigation +#if defined(Q_OS_MACOS) + new QShortcut(QKeySequence(Qt::META | Qt::Key_Down), this, SLOT(selectNoteDown())); + new QShortcut(QKeySequence(Qt::META | Qt::Key_Up), this, SLOT(selectNoteUp())); + new QShortcut(QKeySequence(Qt::META | Qt::Key_L), this, SLOT(setFocusOnText())); +#else new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Down), this, SLOT(selectNoteDown())); new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Up), this, SLOT(selectNoteUp())); + new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_L), this, SLOT(setFocusOnText())); +#endif + new QShortcut(QKeySequence(Qt::Key_Down), this, SLOT(selectNoteDown())); new QShortcut(QKeySequence(Qt::Key_Up), this, SLOT(selectNoteUp())); new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Enter), this, SLOT(setFocusOnText())); new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Return), this, SLOT(setFocusOnText())); - // new QShortcut(QKeySequence(Qt::Key_Enter), this, SLOT(setFocusOnText())); - // new QShortcut(QKeySequence(Qt::Key_Return), this, SLOT(setFocusOnText())); new QShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_F), this, SLOT(fullscreenWindow())); new QShortcut(Qt::Key_F11, this, SLOT(fullscreenWindow())); connect(new QShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_L), this), &QShortcut::activated, this, [=]() { m_listView->setFocus(); }); From 166981d7b884fa44e1aac8e20781e820e69ed06a Mon Sep 17 00:00:00 2001 From: Ishaan Malhotra Date: Thu, 24 Apr 2025 13:47:37 -0400 Subject: [PATCH 2/3] Changed keyboard_shortcuts.md to display the Mac specific commands with Ctrl instead of the Command key --- docs/keyboard_shortcuts.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/keyboard_shortcuts.md b/docs/keyboard_shortcuts.md index e17584f8..b26a364d 100644 --- a/docs/keyboard_shortcuts.md +++ b/docs/keyboard_shortcuts.md @@ -24,10 +24,10 @@ These shortcuts are meant to be used while the Notes window is currently focused | Ctrl + E | Clear the search bar | | Ctrl + (or just ) | Select note below | | Ctrl + (or just ) | Select note above | -| Command + (macOS) | Select note below | -| Command + (macOS) | Select note above | +| Ctrl + (macOS) | Select note below | +| Ctrl + (macOS) | Select note above | | Ctrl + Enter | Focus on the text editor | -| Command + L (macOS) | Focus on the text editor | +| Ctrl + L (macOS) | Focus on the text editor | | Ctrl + Shift + F | Toggle full screen mode | | Ctrl + Shift + K | Toggle kanban view | | F11 | Toggle full screen mode | From 1318b7bb6d1a85a99338a83ecf4b843d74dcda09 Mon Sep 17 00:00:00 2001 From: Ishaan Malhotra Date: Thu, 24 Apr 2025 18:06:18 -0400 Subject: [PATCH 3/3] Fixed spacing in docs, clang-formated code, removed "macOS-specific" from comment in mainwindow.cpp --- docs/keyboard_shortcuts.md | 6 +++--- src/listviewlogic.cpp | 4 ++-- src/mainwindow.cpp | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/keyboard_shortcuts.md b/docs/keyboard_shortcuts.md index b26a364d..eb3c084b 100644 --- a/docs/keyboard_shortcuts.md +++ b/docs/keyboard_shortcuts.md @@ -24,10 +24,10 @@ These shortcuts are meant to be used while the Notes window is currently focused | Ctrl + E | Clear the search bar | | Ctrl + (or just ) | Select note below | | Ctrl + (or just ) | Select note above | -| Ctrl + (macOS) | Select note below | -| Ctrl + (macOS) | Select note above | +| Ctrl + _(macOS)_ | Select note below | +| Ctrl + _(macOS)_ | Select note above | | Ctrl + Enter | Focus on the text editor | -| Ctrl + L (macOS) | Focus on the text editor | +| Ctrl + L _(macOS)_ | Focus on the text editor | | Ctrl + Shift + F | Toggle full screen mode | | Ctrl + Shift + K | Toggle kanban view | | F11 | Toggle full screen mode | diff --git a/src/listviewlogic.cpp b/src/listviewlogic.cpp index 7a8c4481..22543fb9 100644 --- a/src/listviewlogic.cpp +++ b/src/listviewlogic.cpp @@ -191,7 +191,7 @@ void ListViewLogic::selectNoteUp() { // Ensure the list view has focus m_listView->setFocus(); - + auto currentIndex = m_listView->currentIndex(); if (currentIndex.isValid()) { int currentRow = currentIndex.row(); @@ -214,7 +214,7 @@ void ListViewLogic::selectNoteDown() { // Ensure the list view has focus m_listView->setFocus(); - + auto currentIndex = m_listView->currentIndex(); if (currentIndex.isValid()) { int currentRow = currentIndex.row(); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e0c25de4..1273ccce 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -532,8 +532,8 @@ void MainWindow::setupKeyboardShortcuts() new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_D), this, SLOT(deleteSelectedNote())); new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_F), m_searchEdit, SLOT(setFocus())); new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_E), m_searchEdit, SLOT(clear())); - - // Add macOS-specific shortcuts for note navigation + + // Shortcuts for note navigation #if defined(Q_OS_MACOS) new QShortcut(QKeySequence(Qt::META | Qt::Key_Down), this, SLOT(selectNoteDown())); new QShortcut(QKeySequence(Qt::META | Qt::Key_Up), this, SLOT(selectNoteUp())); @@ -543,7 +543,7 @@ void MainWindow::setupKeyboardShortcuts() new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Up), this, SLOT(selectNoteUp())); new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_L), this, SLOT(setFocusOnText())); #endif - + new QShortcut(QKeySequence(Qt::Key_Down), this, SLOT(selectNoteDown())); new QShortcut(QKeySequence(Qt::Key_Up), this, SLOT(selectNoteUp())); new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Enter), this, SLOT(setFocusOnText()));