summaryrefslogtreecommitdiffstats
path: root/src/widgets
diff options
context:
space:
mode:
authorGabriel de Dietrich <gabriel.dedietrich@qt.io>2017-10-24 14:53:31 +0700
committerShawn Rutledge <shawn.rutledge@qt.io>2017-11-07 19:36:29 +0000
commit5d6878f234d1d8697bba43cb5140094dee722a86 (patch)
treea1121f8efc150149f9a793fb4ecf97e4939752d2 /src/widgets
parent7986e1e2f0c88ea305dd8a842884908ed4724fd7 (diff)
QMainWindow: Clear menubar parent when new one is set
In QMainWindow::setMenuBar(), we hide and schedule the current menubar, if any, to be deleted later. However, it remains installed as its whole ancestry's event filter, which could conflict with the newly assigned menubar until the old menubar is destroyed. In our case, we have noticed issues with the Cocoa QPA plugin. We force uninstalling the old menubar as event filter by setting its parent to null, pending its deletion shortly after. This fixes BigMenuCreator's empty menubar when calling it with only the "--new-menubar" option. It also fixes QTBUG-34160 example which was not behaving as well as it should. Task-number: QTBUG-34160 Change-Id: Ifefb72affad01e7b7371005442074afd6a39a5b8 Reviewed-by: Dmitry Shachnev <mitya57@gmail.com> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/widgets')
-rw-r--r--src/widgets/widgets/qmainwindow.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/widgets/widgets/qmainwindow.cpp b/src/widgets/widgets/qmainwindow.cpp
index 5c6f983149..ced7ec38ea 100644
--- a/src/widgets/widgets/qmainwindow.cpp
+++ b/src/widgets/widgets/qmainwindow.cpp
@@ -574,6 +574,7 @@ void QMainWindow::setMenuBar(QMenuBar *menuBar)
menuBar->setCornerWidget(cornerWidget, Qt::TopRightCorner);
}
oldMenuBar->hide();
+ oldMenuBar->setParent(nullptr);
oldMenuBar->deleteLater();
}
topLayout->setMenuBar(menuBar);