Details
-
Bug
-
Resolution: Done
-
P2: Important
-
4.7.0
-
None
-
None
-
-
e2c776862cb9bdf5b651c15934f7e92fe11b989b
Description
We've got a problem in Qt Creator, that, when e.g. opening the preferences, a little toplevel window appears and vanishes again.
I tracked the problem down to
- Designer initializes and creates an instance of a QMenuBar subclass
- in the class' constructor, setNativeMenuBar(false) is called
- the implementation of that unconditionally calls "setVisible(false); setVisible(true);"
---> since the instance doesn't have a parent (yet) it gets shown as a toplevel
The setVisible calls are definitely wrong the way they are.
They solve the problem of setNativeMenuBar(false) being called while the menu is already shown as a native menu bar. (The other way round also works without the setVisible calls.)
See attached sample project (click the button to toggle the nativeMenuBar property).