summaryrefslogtreecommitdiff
path: root/src/controls/qquickmenupopupwindow.cpp
diff options
context:
space:
mode:
authorPaul Olav Tvete <paul.tvete@digia.com>2014-04-23 10:29:38 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-04-25 09:27:00 +0200
commitcdbf6647ff74dc9c5354b0054d9fb60c34406064 (patch)
tree72ee504f2cba93446a635798d22f09f5bad15dec /src/controls/qquickmenupopupwindow.cpp
parent80c440436179d97d84c8493d7e515ac27f28b624 (diff)
downloadqtquickcontrols-cdbf6647ff74dc9c5354b0054d9fb60c34406064.tar.gz
Correct positioning for popups in QQuickWidget
Handle the case where the QQuickWindow is hidden and the content is rendered somewhere else using QQuickRenderControl. Task-number: QTBUG-38116 Change-Id: I51fb9001c307f53bf7d724860b2a66287982724e Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com> Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src/controls/qquickmenupopupwindow.cpp')
-rw-r--r--src/controls/qquickmenupopupwindow.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/controls/qquickmenupopupwindow.cpp b/src/controls/qquickmenupopupwindow.cpp
index ec33b0c1..6a2a03bc 100644
--- a/src/controls/qquickmenupopupwindow.cpp
+++ b/src/controls/qquickmenupopupwindow.cpp
@@ -45,6 +45,7 @@
#include <qpa/qwindowsysteminterface.h>
#include <qquickitem.h>
#include <QtGui/QScreen>
+#include <QtQuick/private/qquickrendercontrol_p.h>
QT_BEGIN_NAMESPACE
@@ -84,8 +85,10 @@ void QQuickMenuPopupWindow::setItemAt(QQuickItem *menuItem)
void QQuickMenuPopupWindow::setParentWindow(QQuickWindow *parentWindow)
{
- if (transientParent() != parentWindow)
- setTransientParent(parentWindow);
+ QWindow *proxyWindow = QQuickRenderControl::renderWindowFor(parentWindow);
+ QWindow *renderWindow = proxyWindow ? proxyWindow : parentWindow;
+ if (transientParent() != renderWindow)
+ setTransientParent(renderWindow);
if (parentWindow) {
connect(parentWindow, SIGNAL(destroyed()), this, SLOT(dismissPopup()));
if (QQuickMenuPopupWindow *pw = qobject_cast<QQuickMenuPopupWindow *>(parentWindow))