linphone-desktop/tests/ui/components/form/ExclusiveButtons.qml
2016-09-13 13:15:54 +02:00

34 lines
786 B
QML

import QtQuick 2.7
// ===================================================================
Row {
property int selectedButton: 0
property variant texts
signal buttonChanged (int button)
spacing: 8
Repeater {
model: texts
SmallButton {
anchors.verticalCenter: parent.verticalCenter
backgroundColor: selectedButton === index
? '#8E8E8E'
: (button.down
? '#FE5E00'
: '#D1D1D1'
)
id: button
text: modelData
onClicked: {
if (selectedButton !== index) {
selectedButton = index
buttonChanged(index)
}
}
}
}
}