summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorminiak <milan.burda@gmail.com>2010-04-07 09:01:03 (GMT)
committerBenjamin Poulain <benjamin.poulain@nokia.com>2010-04-07 09:01:19 (GMT)
commitc1ce854d745b28e2f14057d29e726b8327034e9b (patch)
treeb9675f673a2102db3dbb768f698cd7fa762332f4 /src/gui
parentd65d3becc292523f0962aac9d2bf7b96d9c47c04 (diff)
downloadQt-c1ce854d745b28e2f14057d29e726b8327034e9b.zip
Qt-c1ce854d745b28e2f14057d29e726b8327034e9b.tar.gz
Qt-c1ce854d745b28e2f14057d29e726b8327034e9b.tar.bz2
fix QMenu::popup()
Merge-request: 551 Reviewed-by: Benjamin Poulain <benjamin.poulain@nokia.com>
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/widgets/qmenu.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gui/widgets/qmenu.cpp b/src/gui/widgets/qmenu.cpp
index 404d46e..42f3a15 100644
--- a/src/gui/widgets/qmenu.cpp
+++ b/src/gui/widgets/qmenu.cpp
@@ -1913,10 +1913,9 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
pos.setX(screen.left() + desktopFrame);
}
if (pos.y() + size.height() - 1 > screen.bottom() - desktopFrame) {
- if(snapToMouse)
- pos.setY(qMin(mouse.y() - (size.height() + desktopFrame), screen.bottom()-desktopFrame-size.height()+1));
- else
- pos.setY(qMax(p.y() - (size.height() + desktopFrame), screen.bottom()-desktopFrame-size.height()+1));
+ const int bestPos = (snapToMouse ? mouse.y() : p.y()) - desktopFrame - size.height() + 1;
+ const int fallbackPos = screen.bottom() - desktopFrame - size.height() + 1;
+ pos.setY(qMin(bestPos, fallbackPos));
} else if (pos.y() < screen.top() + desktopFrame) {
pos.setY(screen.top() + desktopFrame);
}