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

MenuBarItem does not lose highlight when a Menu is added using MenuBar.addMenu

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P2: Important
    • 5.14.0 RC1
    • 5.12.2, 5.12.3, 5.12.4, 5.13.0
    • Quick: Controls 2
    • None
    • macOS, Windows
    • 66de71b26a6c3b5be308c1a92287b6490164ae72 (qt/qtquickcontrols2/5.13)

    Description

      When I use `MenuBar.addMenu` to add a dynamically created `Menu`, the `MenuBarItem` does not lose highlight when the `Menu` is dismissed. Here's an example:
       

      import QtQuick 2.12
      import QtQuick.Controls 2.12
      
      ApplicationWindow {
          id: window
          width: 300
          height: 300
          visible: true
      
          Component.onCompleted: mb.addMenu(cmp.createObject(mb))
      
          menuBar: MenuBar {
              id: mb
              width: parent.width
              Menu {
                  title: "This Works"
      
                  MenuItem { text: "Cut" }
                  MenuItem { text: "Copy" }
                  MenuItem { text: "Paste" }
              }
          }
      
          Component {
              id: cmp
              Menu {
                  title: "This Doesn't"
      
                  MenuItem { text: "Cut" }
                  MenuItem { text: "Copy" }
                  MenuItem { text: "Paste" }
              }
          }
      }
      

      When you click on the static menu titled "This Works", it will lose highlight when mouse is clicked on the menu items or outside, but doing the same on the dynamically added menu won't work.
       

      Attachments

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

        Activity

          People

            wang_chuan wang chuan
            furkanzmc Furkan Üzümcü
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes