summaryrefslogtreecommitdiffstats
path: root/src/controls/qquickpopupwindow.cpp
diff options
context:
space:
mode:
authorFrederik Gladhorn <frederik.gladhorn@digia.com>2014-05-01 12:47:18 +0200
committerFrederik Gladhorn <frederik.gladhorn@digia.com>2014-05-01 12:47:18 +0200
commit37d3ecfd3d1ddaff4b12e97926b2c94260164e4c (patch)
tree02d7e17187491b4fad4f049304aa5b77cd4c61ca /src/controls/qquickpopupwindow.cpp
parentf8b75642343123ce355aa33ee8ef6697ff2075f5 (diff)
parent1bd60bec33458136efceac6c16abf2bc3976d984 (diff)
Merge remote-tracking branch 'origin/release' into stable
Diffstat (limited to 'src/controls/qquickpopupwindow.cpp')
-rw-r--r--src/controls/qquickpopupwindow.cpp24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/controls/qquickpopupwindow.cpp b/src/controls/qquickpopupwindow.cpp
index a9e85ff30..56f4c351a 100644
--- a/src/controls/qquickpopupwindow.cpp
+++ b/src/controls/qquickpopupwindow.cpp
@@ -44,6 +44,7 @@
#include <qguiapplication.h>
#include <qpa/qwindowsysteminterface.h>
#include <QtQuick/qquickitem.h>
+#include <QtQuick/private/qquickrendercontrol_p.h>
QT_BEGIN_NAMESPACE
@@ -84,6 +85,19 @@ void QQuickPopupWindow::show()
posx += parentWindow->geometry().left();
posy += parentWindow->geometry().top();
}
+ } else if (m_parentItem && m_parentItem->window()) {
+ QPoint offset;
+ QQuickWindow *quickWindow = m_parentItem->window();
+ QWindow *renderWindow = QQuickRenderControl::renderWindowFor(quickWindow, &offset);
+
+ QPointF pos = m_parentItem->mapToItem(quickWindow->contentItem(), QPointF(posx, posy));
+ posx = pos.x();
+ posy = pos.y();
+ if (renderWindow) {
+ QPoint parentWindowOffset = renderWindow->mapToGlobal(QPoint());
+ posx += offset.x() + parentWindowOffset.x();
+ posy += offset.y() + parentWindowOffset.y();
+ }
}
if (m_contentItem) {
@@ -95,11 +109,15 @@ void QQuickPopupWindow::show()
}
emit geometryChanged();
- if (!qobject_cast<QQuickPopupWindow *>(transientParent())) // No need for parent menu windows
- if (QQuickWindow *w = qobject_cast<QQuickWindow *>(transientParent()))
+ if (!qobject_cast<QQuickPopupWindow *>(transientParent())) { // No need for parent menu windows
+ if (QQuickWindow *w = qobject_cast<QQuickWindow *>(transientParent())) {
if (QQuickItem *mg = w->mouseGrabberItem())
mg->ungrabMouse();
-
+ } else if (m_parentItem && m_parentItem->window()) {
+ if (QQuickItem *mg = m_parentItem->window()->mouseGrabberItem())
+ mg->ungrabMouse();
+ }
+ }
QQuickWindow::show();
setMouseGrabEnabled(true); // Needs to be done after calling show()
setKeyboardGrabEnabled(true);