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.

Pick-to: 5.15 6.0
Change-Id: Ib79615dd1e9394c96d39c8f9851005b4c073c165
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Tor Arne Vestbø 2020-12-10 16:22:09 +01:00
parent 126c5c501a
commit 6198ba217f

View File

@ -114,7 +114,9 @@ void QMenu::setAsDockMenu()
void QMenuPrivate::moveWidgetToPlatformItem(QWidget *widget, QPlatformMenuItem* item)
{
auto *container = new QWidget;
container->setObjectName("MenuItemWidgetContainer");
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);