Reputation: 22936
I have the following in a bb.cascades
QML file:
Container {
id: rangeSelector
bottomPadding: 5
layout: StackLayout {
orientation: LayoutOrientation.LeftToRight
}
Container {
Button {
id: buttonA
text : "1D"
opacity: 1.0
}
}
Container {
Button {
id: buttonB
text : "5D"
opacity: 0.5
}
}
}
How do I change the opacity
of buttonA
, when buttonB
is tapped?
I'm totally new to QML, read some BB10 cascades documentation, but can't find how to hook things like this up.
My goal of this question is to understand how to, in general, change things in other 'objects' on a tap or change inside another. But I do have the above issue (but then with 6 buttons instead of 2; trying to create a kind of SegmentControl with more than 4 segments).
Upvotes: 0
Views: 111
Reputation: 22936
It was quite simple:
Container {
Button {
id: buttonA
text : "1D"
opacity: 1.0
onClicked: {
buttonA.opacity = 1.0
buttonB.opacity = 0.5
}
}
}
Container {
Button {
id: buttonB
text : "5D"
opacity: 0.5
onClicked: {
buttonA.opacity = 0.5
buttonB.opacity = 1.0
}
}
}
Upvotes: 1