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

Qml native menus don't handle invisible menu items

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.8.0
    • None
    • macOS

    Description

      When creating a menu like so:

      Menu {
      	id: m
      	popupType: Popup.Native
      	MenuItem {
      		text: "Item 1"
      	}
      	MenuItem {
      		visible: false
      		text: "Item 2"
      	}
      	MenuItem {
      		text: "Item 3"
      	}
      }
      

      The native menu on macOS will not hide that entry:

      If you switch the popup type to Popup.Window, the entry will be invisible, but still take up space:

      (Also the menu is bigger for some reason)

      I primarily noticed this on macOS, but the problem with Popup.Window seems to apply to all platforms. This prevents me from migrating away from the labs menus to the native menus in Quick.Controls.

      I would expect hidden menu items to not show up in the menu at all and this works for the labs menus.

      Attachments

        1. image-2024-11-09-16-38-17-463.png
          31 kB
          Nicolas Werner
        2. image-2024-11-09-16-39-07-911.png
          18 kB
          Nicolas Werner
        3. mbar.qml
          0.6 kB
          Nicolas Werner
        For Gerrit Dashboard: QTBUG-130996
        # Subject Branch Project Status CR V

        Activity

          People

            mitch_curtis Mitch Curtis
            deepbluev7 Nicolas Werner
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There is 1 open Gerrit change