-
Bug
-
Resolution: Cannot Reproduce
-
P3: Somewhat important
-
None
-
5.9.2
-
None
I have a QMenu (menu2) inside another QMenu (menu1) itself belonging to a QMenuBar. At the beginning menu2 is empty and disabled, and menu1 is enable.
The application (QWidget based) populates menu2 based on some items, and updates menu2 if the number of items changes. Basically doing this:
menu2->clear();
foreach(const Item &item, items)
menu2->addAction(item.text());
menu2->setEnabled(!items.isEmpty());
Very often (90% of cases), menu2 ends up disabled, even though items is not empty. Note that the menu itself is not greyed, but all actions inside are disabled.
I found a turnaround. If I put menu2->setEnabled(false); before menu2->setEnabled(!items.isEmpty()); then the problem disappears.
Also, if I turn off nativeMenuBar on the menubar, then again the problem is fixed.
This problem occurs only on MacOS. On all other platforms (Windows/Linux/iOS/Android/Raspberry) the same code works as expected.
The bad news is that I tried very hard to reproduce this in a small sample, but did not succeed. So there must be something special in my settingsĀ that I didn't catch. The application has several toolbars, a status bar, a QGraphicsScene and many other stuff, I don't know if that can explain this.