QWidgetAction doesn't allow app to quit
I created a menu in my QMainWindow derived class, and added a QWidget to it via QWidgetAction. Now my app does not close and stays in infinite loop when I try to close it. Any hints on why this happens?
Here's the code:
MainWindow* parent = ...;
auto menu = parent->menuBar()->addMenu("Menu");
auto action = new QWidgetAction(menu);
auto widget = new QLabel("Lol");
action->setDefaultWidget(widget);
menu->addAction(action);
This happens under OSX Sierra, Qt 5.8
Re: QWidgetAction doesn't allow app to quit
Considering you haven't told us anything about where this code actually gets executed, and what happens inside the "..." of the first line, it's pretty much impossible to say what the error is.
My guess is that in the first line you are creating a new MainWindow instance (and different from the one you create in main()), so you end up with an app that has multiple instances of MainWindow running at the same time.
Re: QWidgetAction doesn't allow app to quit
I simply created a QMainWindow application on QtCreator and ran it with that code for creating the menu with the widget.
On Ubuntu Linux, nothing is rendered. Under OSX, it creates an infinite loop when I try to close the app
Re: QWidgetAction doesn't allow app to quit
I'll say it again:
Quote:
Considering you haven't told us anything about where this code actually gets executed, and what happens inside the "..." of the first line, it's pretty much impossible to say what the error is.