From 80cde7c7ca22511494ae6d32b2023fb1e92ede4d Mon Sep 17 00:00:00 2001 From: Filippo Cucchetto Date: Fri, 4 Dec 2015 01:34:27 +0100 Subject: Moved menuBar function from QQuickMenuPopupWindow to QQuickmenu Change-Id: I6628ac2b8b07634afc1062488a12788a4e3f66c0 Reviewed-by: J-P Nurmi --- src/controls/qquickmenupopupwindow.cpp | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) (limited to 'src/controls/qquickmenupopupwindow.cpp') diff --git a/src/controls/qquickmenupopupwindow.cpp b/src/controls/qquickmenupopupwindow.cpp index a578ea62..9385be46 100644 --- a/src/controls/qquickmenupopupwindow.cpp +++ b/src/controls/qquickmenupopupwindow.cpp @@ -168,25 +168,11 @@ QQuickMenu *QQuickMenuPopupWindow::menu() const return m_menu; } -QQuickMenuBar *QQuickMenuPopupWindow::menuBar() const -{ - QObject *pi = menu()->parentMenuOrMenuBar(); - while (pi) { - if (QQuickMenuBar *menuBar = qobject_cast(pi)) - return menuBar; - else if (QQuickMenu *menu = qobject_cast(pi)) - pi = menu->parentMenuOrMenuBar(); - else - return 0; - } - return 0; -} - bool QQuickMenuPopupWindow::shouldForwardEventAfterDismiss(QMouseEvent *e) const { // If the event falls inside this item the event should not be forwarded. // For example for comboboxes or top menus of the menubar - QQuickMenuBar *mb = menuBar(); + QQuickMenuBar *mb = m_menu ? m_menu->menuBar() : Q_NULLPTR; QQuickItem *item = mb && !mb->isNative() ? mb->contentItem() : menu()->visualItem(); QWindow *window = transientParent(); if (item && window && item->window() == window) { -- cgit v1.2.1