diff --git a/krusader/BookMan/krbookmarkhandler.cpp b/krusader/BookMan/krbookmarkhandler.cpp --- a/krusader/BookMan/krbookmarkhandler.cpp +++ b/krusader/BookMan/krbookmarkhandler.cpp @@ -577,7 +577,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 +597,27 @@ if (nMatches == 1) { _setQuickSearchText(""); if ((bool) firstMatch->menu()) { - menu->setActiveAction(firstMatch); + menu->setActiveAction(nullptr); + int menuWidth = menu->sizeHint().width(); + QPoint submenuPos = menu->mapToGlobal(QPoint(menuWidth, 0)); + firstMatch->menu()->exec(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); } }