summaryrefslogtreecommitdiff
path: root/src/controls/qquickmenupopupwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/controls/qquickmenupopupwindow.cpp')
-rw-r--r--src/controls/qquickmenupopupwindow.cpp11
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))