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

Expose customizable delegate or titleComponent for submenu titles in Qt Quick Controls 2 Menu

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Unresolved
    • Not Evaluated
    • None
    • None
    • Quick: Controls 2
    • None

    Description

      Currently, the Menu component in Qt Quick Controls 2 allows setting a plain string title for submenu entries and optionally an icon.source property. However, the submenu title delegate (the visual item representing the submenu inside its parent menu) is not customizable: margins, padding, spacing between icon and text, or replacing the title with a custom layout are not supported.

      This limitation leads to inconsistent UI experiences across platforms and styles and forces developers to implement fragile and complex workarounds — such as replacing the submenu title with custom Items and manually handling submenu positioning and open/close logic.


      Proposed Enhancement:

      • Introduce a titleComponent or titleDelegate property on Menu to allow fully customizable submenu title content.
      • Alternatively, expose the internal submenu title titleItem for style and layout customization.
      • Ensure that properties like padding, margin, or spacing between icon and text can be adjusted for submenu titles.
      • Maintain consistent behavior with icon.source for both top-level menus and submenu entries.

      Use Case:
      A typical use case is a submenu titled "Settings" with a gear icon to the left and a right-pointing arrow to indicate a submenu. Developers want to adjust left margin and spacing to align with app style guides. This is currently impossible without custom hacks, which complicate maintenance and reduce reliability.

      Benefits:

      • Cleaner, more maintainable code for complex menus.
      • Consistent styling and behavior across platforms and styles.
      • Enables richer, more user-friendly menu UIs with proper icon/text layouts.

      Attachments

        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
            a.d. Adrian Driewer
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes