diff options
author | Laszlo Agocs <laszlo.agocs@digia.com> | 2014-09-09 17:11:03 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@digia.com> | 2014-09-10 11:56:17 +0200 |
commit | d70e5ebe11a8eb22fe5e71945982d81991dc9f09 (patch) | |
tree | 81dde5c8b680fce109d35904e40dfb7206dc4619 /src/controls/qquickmenupopupwindow.cpp | |
parent | bc91574cca8b6f24968ab4e1cc11fe1fd10f3061 (diff) | |
download | qtquickcontrols-d70e5ebe11a8eb22fe5e71945982d81991dc9f09.tar.gz |
Task-number: QTBUG-40883
Change-Id: I5c46c049b5890259d65f325adb59e15ebf29f84a
Reviewed-by: Robert Loehning <robert.loehning@digia.com>
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
Diffstat (limited to 'src/controls/qquickmenupopupwindow.cpp')
-rw-r--r-- | src/controls/qquickmenupopupwindow.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/controls/qquickmenupopupwindow.cpp b/src/controls/qquickmenupopupwindow.cpp index e07a41d6..bdd1cd6b 100644 --- a/src/controls/qquickmenupopupwindow.cpp +++ b/src/controls/qquickmenupopupwindow.cpp @@ -50,8 +50,10 @@ QT_BEGIN_NAMESPACE QQuickMenuPopupWindow::QQuickMenuPopupWindow() : - QQuickPopupWindow(), m_itemAt(0) -{ } + m_itemAt(0), + m_logicalParentWindow(0) +{ +} void QQuickMenuPopupWindow::show() { @@ -59,6 +61,10 @@ void QQuickMenuPopupWindow::show() // show() will reposition the popup at the last moment, // so its initial position must be captured after the call. m_initialPos = position(); + if (m_logicalParentWindow && m_logicalParentWindow->parent()) { + // This must be a QQuickWindow embedded via createWindowContainer. + m_initialPos += m_logicalParentWindow->geometry().topLeft(); + } } void QQuickMenuPopupWindow::setParentItem(QQuickItem *item) @@ -92,6 +98,7 @@ void QQuickMenuPopupWindow::setParentWindow(QWindow *effectiveParentWindow, QQui effectiveParentWindow = effectiveParentWindow->parent(); if (transientParent() != effectiveParentWindow) setTransientParent(effectiveParentWindow); + m_logicalParentWindow = parentWindow; if (parentWindow) { connect(parentWindow, SIGNAL(destroyed()), this, SLOT(dismissPopup())); if (QQuickMenuPopupWindow *pw = qobject_cast<QQuickMenuPopupWindow *>(parentWindow)) |