02-25-2013 07:24 AM
Hi,
I am going to port a qt application I developed to cascades today and would like a bit of advice.
In my qt app I had a custom QLabel class which just fired of a mouse event when it was pressed and I could figure out where the element was pressed by that qmouseevent and set it's background image accordingly.
How could I do this with cascades as I have quite a few of these custom buttons.
any suggestions appreciated.
02-25-2013 09:03 AM
I think that you can use ImageButton instead of QLabel cause ImageButton can automatically change the image by three status : defaultImageSource, pressedImageSource and disabledImageSource so that you don't need to handle of mouse event. I don't whether it can be your choice or not. thanks
02-25-2013 10:53 AM
Thanks javayoung for your reply,
I seen ImageButton but I have an image with 5 possible states depending on what area was touched, QLabel worked great for this.
anyone know of something simialr for cascades?
02-25-2013 11:22 AM - edited 02-25-2013 11:24 AM
Can you add some rects to overlap those areas once the rect is clicked which can send signal to a slot to change the background image. Similar to this code:
Rectangle {
id: forwarder
width: 100; height: 100
signal send()
onSend: console.log("Send clicked")
MouseArea {
id: mousearea
anchors.fill: parent
onClicked: console.log("MouseArea clicked")
}
Component.onCompleted: {
mousearea.clicked.connect(send)
}
}
02-25-2013 12:09 PM
nice idea, I'll see how I get on.
Thanks.