QMenu: Enable sloppy submenu mouse navigation

Since we're in the 21st century, we set QCommonStyle to return true
to the SH_Menu_SloppySubMenus style hint. This unlocks all the logic
already available in QMenu.

Task-number: QTBUG-20094
[ChangeLog][QtWidgets][QMenu] Enable sloppy submenu mouse navigation
Change-Id: I134c87e348d98d1f46055e0bfef2b4a4a3d2993a
Reviewed-by: Shawn Rutledge <shawn.rutledge@digia.com>
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Gabriel de Dietrich 2014-03-13 08:40:04 +01:00 committed by The Qt Project
parent f5224bd4d1
commit aae382ab3b
3 changed files with 8 additions and 5 deletions

View File

@ -4896,6 +4896,10 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
ret = 256;
break;
case SH_Menu_SloppySubMenus:
ret = true;
break;
case SH_ProgressDialog_TextLabelAlignment:
ret = Qt::AlignCenter;
break;

View File

@ -2532,9 +2532,6 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
ret = QDialogButtons::Reject;
break;
*/
case SH_Menu_SloppySubMenus:
ret = true;
break;
case SH_GroupBox_TextLabelVerticalAlignment:
ret = Qt::AlignTop;
break;

View File

@ -1706,8 +1706,10 @@ void QStyle::drawItemPixmap(QPainter *painter, const QRect &rect, int alignment,
\value SH_Menu_Scrollable Whether popup menus must support scrolling.
\value SH_Menu_SloppySubMenus Whether popupmenu's must support
sloppy submenu; as implemented on Mac OS.
\value SH_Menu_SloppySubMenus Whether popup menus must support
the user moving the mouse cursor to a submenu while crossing
other items of the menu. This is supported on most modern
desktop platforms.
\value SH_ScrollView_FrameOnlyAroundContents Whether scrollviews
draw their frame only around contents (like Motif), or around