diff options
author | Andy Shaw <andy.shaw@digia.com> | 2012-02-06 14:57:22 (GMT) |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-17 04:54:18 (GMT) |
commit | 7a24aa513279ea43d53fb52529d4024694b3b7bb (patch) | |
tree | 25dbe01a6ba884e0e9816a641fab413e4bec3a88 /src/gui | |
parent | 1482b41690861e4f31d0b6693fff0f4da2389015 (diff) | |
download | Qt-7a24aa513279ea43d53fb52529d4024694b3b7bb.zip Qt-7a24aa513279ea43d53fb52529d4024694b3b7bb.tar.gz Qt-7a24aa513279ea43d53fb52529d4024694b3b7bb.tar.bz2 |
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 <pierre.rossi@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/widgets/qmenu.cpp | 21 |
1 files 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 |