From 7a24aa513279ea43d53fb52529d4024694b3b7bb Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 6 Feb 2012 15:57:22 +0100 Subject: Ensure the scrollers appears when there is too many menu items When there are too many items in a single column menu then scrollers will appear for the menu to enable scrolling to the other items. However, this broke in Qt 4.8 as the scrollers would not appear anymore due to the adjustment of the size of the menu to account for the size of the desktop. Task-number: QTBUG-23507 Change-Id: Ib6bb7a5572bc0fbbf3de6dac03a08b69404804a3 Reviewed-by: Pierre Rossi --- src/gui/widgets/qmenu.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp index bc1e029..2eaeacc 100644 --- a/src/gui/widgets/qmenu.cpp +++ b/src/gui/widgets/qmenu.cpp @@ -1850,16 +1850,17 @@ void QMenu::popup(const QPoint &p, QAction *atAction) screen = d->popupGeometry(QApplication::desktop()->screenNumber(p)); const int desktopFrame = style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, this); bool adjustToDesktop = !window()->testAttribute(Qt::WA_DontShowOnScreen); - - // if the screens have very different geometries and the menu is too big, we have to recalculate - if (size.height() > screen.height() || size.width() > screen.width()) { - size = d->adjustMenuSizeForScreen(screen); - adjustToDesktop = true; - } - // Layout is not right, we might be able to save horizontal space - if (d->ncols >1 && size.height() < screen.height()) { - size = d->adjustMenuSizeForScreen(screen); - adjustToDesktop = true; + if (!d->scroll) { + // if the screens have very different geometries and the menu is too big, we have to recalculate + if (size.height() > screen.height() || size.width() > screen.width()) { + size = d->adjustMenuSizeForScreen(screen); + adjustToDesktop = true; + } + // Layout is not right, we might be able to save horizontal space + if (d->ncols >1 && size.height() < screen.height()) { + size = d->adjustMenuSizeForScreen(screen); + adjustToDesktop = true; + } } #ifdef QT_KEYPAD_NAVIGATION -- cgit v0.12