summaryrefslogtreecommitdiff
path: root/src/controls/qtmenupopupwindow.cpp
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@digia.com>2013-03-01 21:07:44 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-03-04 12:47:36 +0100
commita238a5ad5afabbae6682b0f376f4e39611108bdf (patch)
treeef089cf8807e56dc0de02728b6fc8686246139aa /src/controls/qtmenupopupwindow.cpp
parent658ea07229c01405de473265f293e7d39e2b348c (diff)
downloadqtquickcontrols-a238a5ad5afabbae6682b0f376f4e39611108bdf.tar.gz
MenuBar: Fix mouse interaction
Used the same pattern as earlier with Menu. Change-Id: Id7a2d791516ba6d827e90c3b3e11f97dd326ccd5 Reviewed-by: J-P Nurmi <jpnurmi@digia.com>
Diffstat (limited to 'src/controls/qtmenupopupwindow.cpp')
-rw-r--r--src/controls/qtmenupopupwindow.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/controls/qtmenupopupwindow.cpp b/src/controls/qtmenupopupwindow.cpp
index dcb15d22..f690fa91 100644
--- a/src/controls/qtmenupopupwindow.cpp
+++ b/src/controls/qtmenupopupwindow.cpp
@@ -134,14 +134,14 @@ void QtMenuPopupWindow::mouseReleaseEvent(QMouseEvent *e)
void QtMenuPopupWindow::forwardEventToTransientParent(QMouseEvent *e)
{
- QWindow *parentMenuWindow = qobject_cast<QtMenuPopupWindow*>(transientParent());
- if (!parentMenuWindow) {
- if (m_mouseMoved && e->type() == QEvent::MouseButtonRelease)
- dismissMenu();
- } else {
- QPoint parentPos = parentMenuWindow->mapFromGlobal(mapToGlobal(e->pos()));
+ if (!qobject_cast<QtMenuPopupWindow*>(transientParent())
+ && m_mouseMoved && e->type() == QEvent::MouseButtonRelease) {
+ // Clicked outside any menu
+ dismissMenu();
+ } else if (transientParent()) {
+ QPoint parentPos = transientParent()->mapFromGlobal(mapToGlobal(e->pos()));
QMouseEvent pe = QMouseEvent(e->type(), parentPos, e->button(), e->buttons(), e->modifiers());
- QGuiApplication::sendEvent(parentMenuWindow, &pe);
+ QGuiApplication::sendEvent(transientParent(), &pe);
}
}