From 446d63be1b85284d6175b4781859d14668755ae3 Mon Sep 17 00:00:00 2001 From: Debao Zhang Date: Fri, 24 Feb 2012 13:46:33 -0800 Subject: Fix tst_qmenu. Clear away Q_WS_WIN/Q_WS_X11 from QMenu. Using the hint returned by the QPlatformTheme. Task-number: QTBUG-24325 Change-Id: Iaa4da26c74273d7cfc1fbec6519c52d09e10f7bb Reviewed-by: Friedemann Kleint --- src/widgets/widgets/qmenu.cpp | 34 +++++++++++------------------- tests/auto/widgets/widgets/qmenu/qmenu.pro | 1 - 2 files changed, 12 insertions(+), 23 deletions(-) diff --git a/src/widgets/widgets/qmenu.cpp b/src/widgets/widgets/qmenu.cpp index e619cdf4fc..dad12fe6ab 100644 --- a/src/widgets/widgets/qmenu.cpp +++ b/src/widgets/widgets/qmenu.cpp @@ -70,10 +70,8 @@ #include #include #include - -#ifdef Q_WS_X11 -# include -#endif +#include +#include QT_BEGIN_NAMESPACE @@ -177,31 +175,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 { -#ifdef Q_WS_WIN - return QApplication::desktop()->screenGeometry(widget); -#elif defined Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE) + if (QGuiApplicationPrivate::platformTheme() && + QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool()) { return QApplication::desktop()->screenGeometry(widget); - else - return QApplication::desktop()->availableGeometry(widget); -#else + } else { return QApplication::desktop()->availableGeometry(widget); -#endif + } } //Windows and KDE allows menus to cover the taskbar, while GNOME and Mac don't QRect QMenuPrivate::popupGeometry(int screen) const { -#ifdef Q_WS_WIN - return QApplication::desktop()->screenGeometry(screen); -#elif defined Q_WS_X11 - if (X11->desktopEnvironment == DE_KDE) + if (QGuiApplicationPrivate::platformTheme() && + QGuiApplicationPrivate::platformTheme()->themeHint(QPlatformTheme::UseFullScreenForPopupMenu).toBool()) { return QApplication::desktop()->screenGeometry(screen); - else - return QApplication::desktop()->availableGeometry(screen); -#else + } else { return QApplication::desktop()->availableGeometry(screen); -#endif + } } QList > QMenuPrivate::calcCausedStack() const @@ -2261,7 +2251,7 @@ void QMenu::mouseReleaseEvent(QMouseEvent *e) if (action && action == d->currentAction) { if (!action->menu()){ -#if defined(Q_WS_WIN) +#if defined(Q_OS_WIN) //On Windows only context menus can be activated with the right button if (e->button() == Qt::LeftButton || d->topCausedWidget() == 0) #endif @@ -3000,7 +2990,7 @@ void QMenu::internalDelayedPopup() */ void QMenu::setNoReplayFor(QWidget *noReplayFor) { -#ifdef Q_WS_WIN +#ifdef Q_OS_WIN d_func()->noReplayFor = noReplayFor; #else Q_UNUSED(noReplayFor); diff --git a/tests/auto/widgets/widgets/qmenu/qmenu.pro b/tests/auto/widgets/widgets/qmenu/qmenu.pro index 55099f1c54..9efd0302bf 100644 --- a/tests/auto/widgets/widgets/qmenu/qmenu.pro +++ b/tests/auto/widgets/widgets/qmenu/qmenu.pro @@ -3,4 +3,3 @@ TARGET = tst_qmenu QT += widgets testlib SOURCES += tst_qmenu.cpp -win32:CONFIG += insignificant_test # QTBUG-24325 -- cgit v1.2.3