0

How may I put a generic Qt Quick's control inside a Menu? Something like:

ApplicationWindow {
    visible: true
    menu: Menu {
        MenuItem { }
        Slider { }
        Button { }
    }
}

with "standard" Qt you can do that with a QWidgetAction.

jpnurmi
  • 5,716
  • 2
  • 21
  • 37
lambdauser
  • 183
  • 1
  • 8

1 Answers1

0

Unfortunately, the stock menu is pretty much limited to text.

However, you can toy around with the MenuStyle element, and create a style that uses a custom item for the menu delegate which you specify via extra property.

Implementing your own menu component is also a viable solution, especially because:

Note: Styling menus may not be supported on platforms using native menus through their QPA plugin.

I always take the latter approach, because I use UI that is consistent across different platforms and requires functionality which the stock menu elements don't provide.

dtech
  • 47,916
  • 17
  • 112
  • 190