Skip to content

Instantly share code, notes, and snippets.

@CODeRUS
Created January 10, 2017 10:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CODeRUS/a7f83da1622c62a432ff7017ec132a0e to your computer and use it in GitHub Desktop.
Save CODeRUS/a7f83da1622c62a432ff7017ec132a0e to your computer and use it in GitHub Desktop.
multi selection
import QtQuick 2.0
import Sailfish.Silica 1.0
Dialog {
id: dialog
property var itemsModel
property bool multiple
SilicaListView {
id: view
anchors.fill: parent
header: DialogHeader {
title: dialog.multiple ? qsTr("Select items") : qsTr("Select item")
acceptText: qsTr("Ok")
}
model: itemsModel
delegate: Component {
ValueButton {
value: text
highlighted: down || selected
onClicked: {
itemsModel.select(index)
if (!dialog.multiple) {
accept(index)
}
}
}
}
section.property: "group"
section.delegate: Component {
SectionHeader {
text: section
}
}
VerticalScrollDecorator {}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment