qt-bugs@ issue : 49417 bugs.kde.org number : 58719 applied: no author: Lubos Lunak Hello, please consider applying the two attached QPopupMenu patches fixing KDE bugs #58719 and #74778 (http://bugs.kde.org/show_bug.cgi?id=58719, http://bugs.kde.org/show_bug.cgi?id=74778), which complain about keyboard navigation in popup menus being very uncomfortable because of being affected by mouse position despite mouse not being used at all. - hasmouse.patch - (#58719) - use keyboard to open and navigate in any popup menu and "accidentally" hit your mouse. Depending on the mouse cursor position either no popup entry is selected or the random popup entry happening to be at the cursor position becomes highlighted. The patch basically copies the 'hasmouse' code from QMenuBar which prevents the mouse having any effect on the popup if it's outside the popup geometry. [ ... #74778 ... ] --- src/widgets/qpopupmenu.cpp.sav 2004-05-25 21:58:23.000000000 +0200 +++ src/widgets/qpopupmenu.cpp 2004-05-25 22:02:19.520297888 +0200 @@ -253,6 +253,7 @@ public: } scroll; QSize calcSize; QRegion mouseMoveBuffer; + uint hasmouse : 1; }; static QPopupMenu* active_popup_menu = 0; @@ -272,6 +273,7 @@ QPopupMenu::QPopupMenu( QWidget *parent, d->scroll.scrollableSize = d->scroll.topScrollableIndex = 0; d->scroll.scrollable = QPopupMenuPrivate::Scroll::ScrollNone; d->scroll.scrolltimer = 0; + d->hasmouse = 0; isPopupMenu = TRUE; #ifndef QT_NO_ACCEL autoaccel = 0; @@ -1740,6 +1742,11 @@ void QPopupMenu::mouseMoveEvent( QMouseE int item = itemAtPos( e->pos() ); if ( item == -1 ) { // no valid item + if( !d->hasmouse ) { + tryMenuBar( e ); + return; + } + d->hasmouse = 0; int lastActItem = actItem; actItem = -1; if ( lastActItem >= 0 ) @@ -1751,6 +1758,7 @@ void QPopupMenu::mouseMoveEvent( QMouseE } } else { // mouse on valid item // but did not register mouse press + d->hasmouse = 1; if ( (e->state() & Qt::MouseButtonMask) && !mouseBtDn ) mouseBtDn = TRUE; // so mouseReleaseEvent will pop down @@ -2159,6 +2167,7 @@ void QPopupMenu::timerEvent( QTimerEvent */ void QPopupMenu::leaveEvent( QEvent * ) { + d->hasmouse = 0; if ( testWFlags( WStyle_Tool ) && style().styleHint(QStyle::SH_PopupMenu_MouseTracking, this) ) { int lastActItem = actItem; actItem = -1;