Represents a list of choices to the user. More...
Inherits CommonDialog
This element was introduced in Qt Quick Components 1.0.
With SelectionDialog you can customize the visual representation of the selectable items' list by overriding the ListView delegate. By default SelectionDialog provides a scrollable list of textual menu items. The user can choose one item from the list at a time.
The example below illustrates how to use the data models with the SelectionDialog. It has two dialogs that both allow the user to choose from three different items. Both dialogs use the default delegate. The first dialog uses a simple string list model and the second dialog uses a ListModel that contains one named role.
SelectionDialog { id: dialog1 titleText: "Select team:" model: ["Manchester United", "Barcelona", "Dynamo United"] } SelectionDialog { id: dialog2 titleText: "Which one wins?" model: ListModel { ListElement { name: "Rock" } ListElement { name: "Paper" } ListElement { name: "Scissors" } } }
See also delegate.
The model that defines the selection dialogs item list. The SelectionDialog uses it as a ListView components model in the dialog. The default delegate assumes that the model data is provided via the modelData role and interprets it as a text string. If you use a custom delegate, the model can be anything supported by QML ListView component.
Note: If the model contains only one named role, it is always provided via the modelData role. This also applies to a simple string list model. For more information, see QML Data Models documentation.
Index of the currently selected item in the model. The default value is -1, which means that no item is selected.