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

QML menu set to visible on creation doesn't show

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • 6.8.3
    • Quick: Controls 2
    • None

    Description

      Having a `Menu { visible: true; ... }` used to work just fine, but now prints `QML Menu: cannot show menu: parent is null`. I could verify in the debugger that first the `visible` property is set and then `setParentItem` is called. This means the menu won't be visible on creation, which used to work. This seems to be a regression. 

      Here's my mini example:

       

      import QtQuick
      import QtQuick.Controls
      
      ApplicationWindow {
          width: 600
          height: 400
          visible: true
      
          Item {
              width: 100
              height: 100
              anchors.centerIn: parent
              
              Menu {
                  title: "Some Menu"
                  visible: true
                  MenuItem {
                      text: "Action 1"
                  }
              }
          }
      }

       

       

      Attachments

        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
            marcel.gotsch Marcel Gotsch
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes