macOS: Disable WA_QuitOnClose on menu item widget container

Otherwise it will prevent quitting of the application when the last
window is closed, on account of (seemingly) being a top level window.

Change-Id: Ib79615dd1e9394c96d39c8f9851005b4c073c165
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 6198ba217f3a9b31d44375b26f3635f15fc01b3d)
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
This commit is contained in:
Tor Arne Vestbø 2020-12-10 16:22:09 +01:00
parent fbcc6a346b
commit 4339088503

View File

@ -115,6 +115,7 @@ void QMenuPrivate::moveWidgetToPlatformItem(QWidget *widget, QPlatformMenuItem*
{
auto *container = new QWidget;
container->setAttribute(Qt::WA_TranslucentBackground);
container->setAttribute(Qt::WA_QuitOnClose, false);
QObject::connect(platformMenu, SIGNAL(destroyed()), container, SLOT(deleteLater()));
container->resize(widget->sizeHint());
widget->setParent(container);