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

[macOS] [labs.platform] Menu stuck on opening when standard icons are used

    XMLWordPrintable

Details

    • macOS
    • 55f41eb67 (dev), c8a2794c4 (dev), 65144dba0 (6.8), 5aafe2851 (6.8), 859c88870 (6.7), 14df2283d (6.7), 88ac8a8b5 (tqtc/lts-6.5)

    Description

      Menu stuck on opening when standard icons are used

      Code sample:

      import QtQuick
      import Qt.labs.platform as Labs
      
      Window {
          id: window
          visible: true
          width: 320
          height: 400
      
          function standard_icon_name(action) {
              //return "" // there is no problem if return empty icon name
              return "edit-" + action
          }
      
          Labs.Menu {
              id: menu
              property list<string> extraItems
      
              Instantiator {
                  model: menu.extraItems
                  delegate: Labs.MenuItem { text: modelData }
                  onObjectAdded: (index, object) => menu.insertItem(index, object)
                  onObjectRemoved: (index, object) => menu.removeItem(object)
              }
      
              Labs.MenuItem {
                  text: qsTr("Undo")
                  icon.name: standard_icon_name("undo")
              }
      
              Labs.MenuItem {
                  text: qsTr("Redo")
                  icon.name: standard_icon_name("redo")
              }
      
              Labs.MenuItem {
                  text: qsTr("Cut")
                  icon.name: standard_icon_name("cut")
              }
      
              Labs.MenuItem {
                  text: qsTr("Copy")
                  icon.name: standard_icon_name("copy")
              }
      
              Labs.MenuItem {
                  text: qsTr("Paste")
                  icon.name: standard_icon_name("paste")
              }
      
              Labs.MenuItem {
                  text: qsTr("Delete")
                  icon.name: standard_icon_name("delete")
              }
          }
      
      
          TapHandler {
              acceptedButtons: Qt.RightButton
              onTapped: {
                  menu.extraItems = []
      
                  let _extraItems = []
                  for (let i = 0; i < 20; ++i)
                      _extraItems.push("Item" + i)
      
                  menu.extraItems = _extraItems
                  menu.open()
              }
          }
      }
      

      Hot path:

       ...
      23  -[NSImage drawInRect:fromRect:operation:fraction:respectFlipped:hints:]                                                                                                                                                                                                                                    (arm64e) /System/Library/Frameworks/AppKit.framework/Versions/C/AppKit                                                   0x18fd8b434 
      24  QAppleIconEngine::paint(QPainter *, QRect const&, QIcon::Mode, QIcon::State)                                                                                                                                                                                                                               qappleiconengine.mm                                                                                                 454  0x102f9f1dc 
      25  QAppleIconEngine::scaledPixmap(QSize const&, QIcon::Mode, QIcon::State, double)                                                                                                                                                                                                                            qappleiconengine.mm                                                                                                 412  0x102f9ef9c 
      26  QIcon::pixmap(QSize const&, double, QIcon::Mode, QIcon::State) const                                                                                                                                                                                                                                       qicon.cpp                                                                                                           885  0x102c2efd4 
      27  +[NSImage(QtExtras) imageFromQIcon:withSize:]                                                                                                                                                                                                                                                              qcoregraphics.mm                                                                                                    136  0x102f90a80 
      28  QCocoaMenuItem::sync()                                                                                                                                                                                                                                                                                     qcocoamenuitem.mm                                                                                                   375  0x10020aa38 
      29  QCocoaMenu::syncMenuItem_helper(QPlatformMenuItem *, bool)                                                                                                                                                                                                                                                 qcocoamenu.mm                                                                                                       233  0x1002046f0 
      30  QQuickLabsPlatformMenuItem::sync()                                                                                                                                                                                                                                                                         qquicklabsplatformmenuitem.cpp                                                                                      163  0x101a637b0 
      31  QQuickLabsPlatformMenu::sync()                                                                                                                                                                                                                                                                             qquicklabsplatformmenu.cpp                                                                                          252  0x101a5dcac 
      32  QQuickLabsPlatformMenu::insertItem(int, QQuickLabsPlatformMenuItem *)                                                                                                                                                                                                                                      qquicklabsplatformmenu.cpp                                                                                          559  0x101a5e858 
      ...
      

      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
              studiosus Vladimir Belyavsky
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: