linphone-desktop/tests/ui/modules/Linphone/Form/ExclusiveButtons.qml
Ronan Abhamon 421eae38a3 feat(app): many changes:
- InvertedMouseArea use a asynchronous call on pressed event
- ListForm use an external style
- ListForm supports outside click
- ...
2016-09-28 17:31:09 +02:00

40 lines
877 B
QML

import QtQuick 2.7
import Linphone.Styles 1.0
// ===================================================================
Row {
property var texts
property int _selectedButton: 0
signal clicked (int button)
spacing: ExclusiveButtonsStyle.buttonsSpacing
Repeater {
model: texts
SmallButton {
anchors.verticalCenter: parent.verticalCenter
backgroundColor: _selectedButton === index
? ExclusiveButtonsStyle.button.color.selected
: (down
? ExclusiveButtonsStyle.button.color.pressed
: (hovered
? ExclusiveButtonsStyle.button.color.hovered
: ExclusiveButtonsStyle.button.color.normal
)
)
text: modelData
onClicked: {
if (_selectedButton !== index) {
_selectedButton = index
clicked(index)
}
}
}
}
}