summaryrefslogtreecommitdiffstats
path: root/src/widgets/widgets
diff options
context:
space:
mode:
authorDebao Zhang <dbzhang800@gmail.com>2012-02-24 13:46:33 -0800
committerQt by Nokia <qt-info@nokia.com>2012-02-27 20:52:45 +0100
commit446d63be1b85284d6175b4781859d14668755ae3 (patch)
treefefc60cf8394d3088c3f85c52cfcf2925684295e /src/widgets/widgets
parent63017136a1a6625c3528f9b237468a55b7fab12c (diff)
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 <Friedemann.Kleint@nokia.com>
Diffstat (limited to 'src/widgets/widgets')
-rw-r--r--src/widgets/widgets/qmenu.cpp34
1 files changed, 12 insertions, 22 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 <private/qpushbutton_p.h>
#include <private/qaction_p.h>
#include <private/qsoftkeymanager_p.h>
-
-#ifdef Q_WS_X11
-# include <private/qt_x11_p.h>
-#endif
+#include <private/qguiapplication_p.h>
+#include <qplatformtheme_qpa.h>
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<QPointer<QWidget> > 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);