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

QML MenuItem disappear after highlighting using Instantiator

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: P1: Critical P1: Critical
    • 5.12.0 RC
    • 5.12.0 Beta 1
    • Quick: Controls 2
    • None
    • macOS
    • 953fbac6131823e4fce0eb4707a854469c4c04ff (qt/qtquickcontrols2/5.12.0)
    • Bug Fixing Week Q2/2020

      In my application I dynamically populate a Menu using QMLs Instantiator. This works fine with Qt 5.11.2, but is not with 5.12.0 beta1 (only tested on macOS Mojave).

      Initial all MenuItem's are visible, but as soon as I hover these they disappear.

       

      This code works as expected with qmlscene from 5.11 and is broken using qmlscene from 5.12:

      import QtQml 2.11
      import QtQuick 2.11
      import QtQuick.Controls 2.4
      
      ApplicationWindow {
          visible: true
          width: 640
          height: 480
      
          menuBar: MenuBar {
              Menu {
                  title: qsTr("&Ok")
                  MenuItem { text: "A" }
                  MenuItem { text: "B" }
                  MenuItem { text: "C" }
              }
      
              Menu {
                  id: moduleMenu
                  title: qsTr("&Broken")
      
                  Instantiator {
                      model: ["A", "B", "C"]
      
                      MenuItem { text: modelData }
      
                      onObjectAdded: moduleMenu.insertItem(index, object)
                      onObjectRemoved: moduleMenu.removeItem(object)
                  }
              }
          }
      }
      

        For Gerrit Dashboard: QTBUG-71066
        # Subject Branch Project Status CR V

            mitch_curtis Mitch Curtis
            hilefoks Stefan Böhmann
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes