diff options
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/widgets/qmenu.cpp | 22 | ||||
-rw-r--r-- | src/widgets/widgets/qmenu_p.h | 4 |
2 files changed, 14 insertions, 12 deletions
diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index 46525b6124..9b2856a728 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -263,20 +263,23 @@ int QMenuPrivate::scrollerHeight() const } //Windows and KDE allows 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 QApplication::desktop()->screenGeometry(widget); + return QApplication::desktop()->screenGeometry(q); } else { - return QApplication::desktop()->availableGeometry(widget); + return QApplication::desktop()->availableGeometry(q); } } //Windows and KDE allows 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 QApplication::desktop()->screenGeometry(screen); } else { @@ -301,8 +304,7 @@ QVector<QPointer<QWidget> > QMenuPrivate::calcCausedStack() const void QMenuPrivate::updateActionRects() const { - Q_Q(const QMenu); - updateActionRects(popupGeometry(q)); + updateActionRects(popupGeometry()); } void QMenuPrivate::updateActionRects(const QRect &screen) const @@ -1069,7 +1071,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(); @@ -2322,7 +2324,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(QApplication::desktop()->screenNumber(p)); @@ -3592,7 +3594,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(QApplication::desktop()->screenNumber(pos())); diff --git a/src/widgets/widgets/qmenu_p.h b/src/widgets/widgets/qmenu_p.h index 2f04fac3c0..785a9db308 100644 --- a/src/widgets/widgets/qmenu_p.h +++ b/src/widgets/widgets/qmenu_p.h @@ -316,8 +316,8 @@ public: mutable QHash<QAction *, QWidget *> widgetItems; void updateActionRects() const; void updateActionRects(const QRect &screen) const; - QRect popupGeometry(const QWidget *widget) const; - QRect popupGeometry(int screen = -1) const; + QRect popupGeometry() const; + QRect popupGeometry(int screen) const; mutable uint ncols : 4; //4 bits is probably plenty uint collapsibleSeparators : 1; uint toolTipsVisible : 1; |