Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-9947

Mac: Menu bars unconditionally shown when setNativeMenuBar is called

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 4.7.0
    • 4.7.0
    • None
    • None
    • macOS
    • 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).

      Attachments

        1. fail.tgz
          2 kB
        2. untitled.tgz
          2 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            freling Fabien Freling (closed Nokia identity) (Inactive)
            con Eike Ziller
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes