Skip to content

Commit

Permalink
Merge pull request #1312 from willcode/fix/restore-bookmark-delete-key
Browse files Browse the repository at this point in the history
bookmarks: restore Delete key
  • Loading branch information
argilo authored Oct 19, 2023
2 parents ef017bc + 03ebc21 commit 91a87cf
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
5 changes: 5 additions & 0 deletions resources/news.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@

2.17.3: In progress...

FIXED: Delete key shortcut for bookmark removal.


2.17.2: Released October 9, 2023

NEW: FORCE_QT6 and FORCE_QT5 CMake options to force Qt version.
Expand Down
14 changes: 11 additions & 3 deletions src/qtgui/dockbookmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,20 @@ void DockBookmarks::on_tableWidgetTagList_itemChanged(QTableWidgetItem *item)

bool DockBookmarks::eventFilter(QObject* object, QEvent* event)
{
if (event->type() == QEvent::KeyPress)
// Since Key_Delete can be (is) used as a global shortcut, override the
// shortcut. Accepting a ShortcutOverride causes the event to be delivered
// again, but as a KeyPress.
if (event->type() == QEvent::KeyPress || event->type() == QEvent::ShortcutOverride)
{
QKeyEvent* pKeyEvent = static_cast<QKeyEvent *>(event);
if (pKeyEvent->key() == Qt::Key_Delete && ui->tableViewFrequencyList->hasFocus())
if (pKeyEvent->key() == Qt::Key_Delete)
{
return DeleteSelectedBookmark();
if (event->type() == QEvent::ShortcutOverride) {
event->accept();
}
else {
return DeleteSelectedBookmark();
}
}
}
return QWidget::eventFilter(object, event);
Expand Down

0 comments on commit 91a87cf

Please sign in to comment.