property string text: ""
property bool checkable: false
property bool checked: false
+ property alias acceptedButtons: ma.acceptedButtons
- signal clicked
+ signal clicked(var mouse)
signal checkedChangedByUser(bool checked)
width: label.width + 6
onPressed: buttonRoot.state = "pressed"
onReleased: {
if (buttonRoot.state === "pressed") {
- buttonRoot.clicked();
+ buttonRoot.clicked(mouse);
if (checkable) {
checked = !checked
buttonRoot.checkedChangedByUser(checked)
signal activated(int index)
+ acceptedButtons: Qt.LeftButton | Qt.RightButton
+
ListModel {
id: ph
}
onClicked: {
if (!model) return;
var nextIndex = currentIndex;
- ++nextIndex;
- if (nextIndex >= model.count)
- nextIndex = 0;
+ if (mouse.button & Qt.LeftButton) {
+ ++nextIndex;
+ if (nextIndex >= model.count)
+ nextIndex = 0;
+ } else if (mouse.button & Qt.RightButton) {
+ --nextIndex;
+ if (nextIndex < 0)
+ nextIndex = model.count - 1;
+ if (!model.count)
+ nextIndex = 0;
+ }
+
if (nextIndex === currentIndex)
return;