Description
The ActionMenu provides a list of text entries that can be clicked. The triggered() signal returns the selected index. The payload property can store a second list with additional data for the entry list. The ActionMenu will elide text that exceeds its maximum width set via maxWidth. Otherwise the width will always be as small as possible, with minimum minWidth. If the entries height exceeds the windows height, it will enable flicking.
API Properties
- variant model
- The text entries as string list.
- variant payload
- An array which contains the entries needed additional data.
- int minWidth
- The minimum width of the ActionMenu.
- int maxWidth
- The maximum width of the ActionMenu. Text that exceeds the maximum width will be elided.
- int textMargin
- Left and right margin of the text entries.
- item currentItem
- Stores the currently pressed Item to reset the pressed state on move.
- int selectedIndex
- Stores the index of the currently selected item. Can be set from outside, but make sure it's set after a model is set, because setting a model resets the selectedIndex to -1.
Private properties
- int currentWidth
- Computed minimum width to show the text completely, clamped by minWidth and maxWidth.
Signals
- triggered
- Emitted when a entry is clicked.
- Parameters:
- int index, the index of the currentItem.
Functions
-
Example
- see ModalContextMenu documentation.