diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-06-28 12:04:30 +0200 |
---|---|---|
committer | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-07-01 10:25:58 +0200 |
commit | df295d70421f068a567d0e37784bf7a1def56073 (patch) | |
tree | eff20b95fd529c76a8ab7e2c4db26a76fae5fa7b /src/controls/qquickmenu.cpp | |
parent | ce8e6301b4a80eebb081c8713fe8462bcc211351 (diff) | |
download | qtquickcontrols-df295d70421f068a567d0e37784bf7a1def56073.tar.gz |
Use the correct parent window for menu popups
The previous fix applied only to the non-platform menu case and was
broken on OS X at least, when having a combobox in a QQuickWidget.
Task-number: QTBUG-39908
Change-Id: I5dde103c2fe33d52a312cc80b36b47b13e72a188
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/controls/qquickmenu.cpp')
-rw-r--r-- | src/controls/qquickmenu.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/controls/qquickmenu.cpp b/src/controls/qquickmenu.cpp index c12060bf..3ae9b5e0 100644 --- a/src/controls/qquickmenu.cpp +++ b/src/controls/qquickmenu.cpp @@ -51,6 +51,7 @@ #include <QtGui/qpa/qplatformtheme.h> #include <QtGui/qpa/qplatformmenu.h> #include <qquickitem.h> +#include <QtQuick/private/qquickrendercontrol_p.h> QT_BEGIN_NAMESPACE @@ -395,7 +396,11 @@ void QQuickMenu::__popup(qreal x, qreal y, int atItemIndex) QQuickMenuBase *atItem = menuItemAtIndex(atItemIndex); - QQuickWindow *parentWindow = findParentWindow(); + QQuickWindow *quickWindow = findParentWindow(); + QWindow *parentWindow = quickWindow; + QWindow *renderWindow = QQuickRenderControl::renderWindowFor(static_cast<QQuickWindow *>(parentWindow)); + if (renderWindow) + parentWindow = renderWindow; // may not be a QQuickWindow anymore (happens when using QQuickWidget) if (m_platformMenu) { QPointF screenPosition(x + m_xOffset, y + m_yOffset); @@ -410,7 +415,7 @@ void QQuickMenu::__popup(qreal x, qreal y, int atItemIndex) if (visualItem()) m_popupWindow->setParentItem(visualItem()); else - m_popupWindow->setParentWindow(parentWindow); + m_popupWindow->setParentWindow(parentWindow, quickWindow); m_popupWindow->setPopupContentItem(m_menuContentItem); m_popupWindow->setItemAt(atItem ? atItem->visualItem() : 0); |