Index: krusader/BookMan/krbookmarkhandler.cpp =================================================================== --- krusader/BookMan/krbookmarkhandler.cpp +++ krusader/BookMan/krbookmarkhandler.cpp @@ -529,8 +529,9 @@ bool quickSearchStarted = false; if (kev->modifiers() != Qt::NoModifier || - kev->text().isEmpty() || - kev->key() == Qt::Key_Delete) { + kev->text().isEmpty() || + kev->key() == Qt::Key_Delete || + kev->key() == Qt::Key_Escape) { return QObject::eventFilter(obj, ev); } @@ -565,7 +566,7 @@ if (act->text().contains('&' + kev->text(), Qt::CaseInsensitive)) { qDebug() << "Bookmark search: hit accelerator key of" << act; _setQuickSearchText(""); - break; + return QObject::eventFilter(obj, ev); } // strip accelerator keys from actions so they don't interfere with the search key press events @@ -577,7 +578,8 @@ // match prefix of the action text to the query if (act->text().left(_quickSearchText().length()).compare(_quickSearchText(), Qt::CaseInsensitive) == 0) { _highlightAction(act); - if (!firstMatch) { + if (!firstMatch || firstMatch->menu()) { + //Can't highlight menus (see comment below), hopefully pick something we can firstMatch = act; } nMatches++; @@ -596,14 +598,27 @@ if (nMatches == 1) { _setQuickSearchText(""); if ((bool) firstMatch->menu()) { - menu->setActiveAction(firstMatch); + menu->setActiveAction(nullptr); + QRect firstMatchGeom = menu->actionGeometry(firstMatch); + QPoint submenuPos = menu->mapToParent(firstMatchGeom.topRight()); + firstMatch->menu()->popup(submenuPos); } else { firstMatch->activate(QAction::Trigger); } - } else { - // if no match is found, firstMatch == nullptr - // this is intended as it will unset active item of the menu - menu->setActiveAction(firstMatch); + return true; + } else if (nMatches > 1) { + //because of a bug submenus cannot be highlighted + //https://bugreports.qt.io/browse/QTBUG-939 + if (!firstMatch->menu()) { + menu->setActiveAction(firstMatch); + } else { + qDebug() << "We only found submenus, highlighting nothing"; + menu->setActiveAction(nullptr); + } + return true; + } + else { + menu->setActiveAction(nullptr); } }