summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets/qmenu.cpp
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2017-08-31 13:10:18 +0200
committerLiang Qi <liang.qi@qt.io>2017-08-31 14:31:31 +0200
commit112a4af10741409b3d8503cb77852a777b607ce0 (patch)
treefa99f0f37fc1505522fe9368e95484c7732ccda8 /src/widgets/widgets/qmenu.cpp
parent29ef0d2bccd1874e20de94485ee05777c3a95c5d (diff)
parente938150412d22e61926fe16791158805b71268bb (diff)
Merge remote-tracking branch 'origin/5.9' into dev
Conflicts: examples/examples.pro qmake/library/qmakebuiltins.cpp src/corelib/global/qglobal.cpp Re-apply b525ec2 to qrandom.cpp(code movement in 030782e) src/corelib/global/qnamespace.qdoc src/corelib/global/qrandom.cpp src/gui/kernel/qwindow.cpp Re-apply a3d59c7 to QWindowPrivate::setVisible() (code movement in d7a9e08) src/network/ssl/qsslkey_openssl.cpp src/plugins/platforms/android/androidjniinput.cpp src/plugins/platforms/xcb/qxcbconnection.cpp src/plugins/platforms/xcb/qxcbconnection_xi2.cpp src/widgets/widgets/qmenu.cpp tests/auto/widgets/kernel/qwidget_window/tst_qwidget_window.cpp Change-Id: If7ab427804408877a93cbe02079fca58e568bfd3
Diffstat (limited to 'src/widgets/widgets/qmenu.cpp')
-rw-r--r--src/widgets/widgets/qmenu.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp
index ab89b8a415..0355bb44f7 100644
--- a/src/widgets/widgets/qmenu.cpp
+++ b/src/widgets/widgets/qmenu.cpp
@@ -264,20 +264,23 @@ int QMenuPrivate::scrollerHeight() const
}
//Windows and KDE allow menus to cover the taskbar, while GNOME and Mac don't
-QRect QMenuPrivate::popupGeometry(const QWidget *widget) const
+QRect QMenuPrivate::popupGeometry() const
{
- if (QGuiApplicationPrivate::platformTheme() &&
+ Q_Q(const QMenu);
+ if (!tornoff && // Torn-off menus are different
+ QGuiApplicationPrivate::platformTheme() &&
QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool()) {
- return QDesktopWidgetPrivate::screenGeometry(widget);
+ return QDesktopWidgetPrivate::screenGeometry(q);
} else {
- return QDesktopWidgetPrivate::availableGeometry(widget);
+ return QDesktopWidgetPrivate::availableGeometry(q);
}
}
//Windows and KDE allow menus to cover the taskbar, while GNOME and Mac don't
QRect QMenuPrivate::popupGeometry(int screen) const
{
- if (QGuiApplicationPrivate::platformTheme() &&
+ if (!tornoff && // Torn-off menus are different
+ QGuiApplicationPrivate::platformTheme() &&
QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool()) {
return QDesktopWidgetPrivate::screenGeometry(screen);
} else {
@@ -307,8 +310,7 @@ bool QMenuPrivate::isContextMenu() const
void QMenuPrivate::updateActionRects() const
{
- Q_Q(const QMenu);
- updateActionRects(popupGeometry(q));
+ updateActionRects(popupGeometry());
}
void QMenuPrivate::updateActionRects(const QRect &screen) const
@@ -1076,7 +1078,7 @@ void QMenuPrivate::scrollMenu(QAction *action, QMenuScroller::ScrollLocation loc
if (newScrollFlags & QMenuScroller::ScrollUp)
newOffset -= vmargin;
- QRect screen = popupGeometry(q);
+ QRect screen = popupGeometry();
const int desktopFrame = q->style()->pixelMetric(QStyle::PM_MenuDesktopFrameWidth, 0, q);
if (q->height() < screen.height()-(desktopFrame*2)-1) {
QRect geom = q->geometry();
@@ -2330,7 +2332,7 @@ void QMenu::popup(const QPoint &p, QAction *atAction)
#if QT_CONFIG(graphicsview)
bool isEmbedded = !bypassGraphicsProxyWidget(this) && d->nearestGraphicsProxyWidget(this);
if (isEmbedded)
- screen = d->popupGeometry(this);
+ screen = d->popupGeometry();
else
#endif
screen = d->popupGeometry(QDesktopWidgetPrivate::screenNumber(p));
@@ -3599,7 +3601,7 @@ void QMenu::internalDelayedPopup()
#if QT_CONFIG(graphicsview)
bool isEmbedded = !bypassGraphicsProxyWidget(this) && d->nearestGraphicsProxyWidget(this);
if (isEmbedded)
- screen = d->popupGeometry(this);
+ screen = d->popupGeometry();
else
#endif
screen = d->popupGeometry(QDesktopWidgetPrivate::screenNumber(pos()));