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

Dynamically adding MenuItem instances generates QQmlComponent warning.

    XMLWordPrintable

Details

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

    Description

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

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

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes