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

Dynamically adding MenuItem instances generates QQmlComponent warning.

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.7.0
    • Quick: Controls 2
    • None
    • Windows 10

      When you dynamically create MenuItem instances you get the following warning at runtime: QQmlComponent: Created graphical object was not placed in the graphics scene.

      Sample code:

      Menu {
              id: menu
      
              Component.onCompleted: {
                  for (var i = 0; i < 5; i ++) {
                      var menuItem = menuItemComponent.createObject(menu)
                      menu.addItem(menuItem)
                  }
              }
      
              Component {
                  id: menuItemComponent
      
                  MenuItem {
                      text: "Menu Item"
                  }
              }
          }
      

        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
            rupert_d Rupert Daniel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes