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

MenuItem with "visible: false" leaves behind empty entry

    XMLWordPrintable

Details

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

    Description

      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)
              }
          }
      }

       

       

      Attachments

        Issue Links

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

          Activity

            People

              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

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes