bookmarks: restore Delete key

Delete is used as a global shortcut to clear the waterfall. It is
also used to delete a bookmark, when the bookmarks table has focus.
Allow the bookmarks table to override the global Delete shortcut.

Signed-off-by: Jeff Long <willcode4@gmail.com>
This commit is contained in:
Jeff Long 2023-10-12 17:21:30 -04:00 committed by Clayton Smith
parent ef017bc877
commit 0a76cc9b03

View File

@ -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);