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

MenuItem with "visible: false" leaves behind empty entry

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.11.1
    • Quick: Controls 2
    • None

      When a MenuItem has "visible: false" set (or is behind a Loader that is not active), it still leaves an empty menu entry.

      import QtQuick 2.0
      import QtQuick.Controls 2.2
      
      Rectangle {
          id: root
          width: 1024
          height: 768
          color: "blue"
      
          property bool showEntry: true
      
          Menu {
              id: testMenu
      
              MenuItem {
                  text: "Static"
              }
      
              MenuItem {
                  visible: root.showEntry
                  text: "Dynamic"
              }
          }
      
          MouseArea {
              anchors.fill: parent
              onClicked: {
                  root.showEntry = false
                  testMenu.popup(mouse.x, mouse.y)
              }
          }
      }

       

       

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            qt.team.quick.subscriptions Qt Quick and Widgets Team
            tmcguire_pix4d Thomas McGuire
            Votes:
            1 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes