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

When menu items are dynamically added to Menu, it should resize to fit

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 6.9.0
    • Quick: Controls 2
    • None
    • macOS, Windows
    • 72b558bd3 (dev), 1508afa3d (6.9), d374adec3 (tqtc/lts-6.8)

    Description

      With the approach taken in https://codereview.qt-project.org/c/qt/qtdeclarative/+/632999 to customize a TextArea's default context menu:

      Component.onCompleted: {
      ...
        const menu = textArea.ContextMenu.menu
        menu.addItem(menuSeparatorComponent.createObject(menu.contentItem))
        menu.addAction(fontDialogAction)
        menu.addAction(colorDialogAction)
      }
      

      it seems the existing ContextMenu was "styled" according to the items it had at the beginning. On some styles, when new items are added, the menu becomes scrollable, which looks odd (and it's not even obvious that there are more menu items until you attempt scrolling). Probably it should get resized so that they fit.

      Fusion, Universal, Material, and Basic styles are all fine. macOS and FluentWinUI3 styles are doing this scrolling within the menu.

      Attachments

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

        Activity

          People

            mitch_curtis Mitch Curtis
            srutledg Shawn Rutledge
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: