[Solved] Custom Component [propery alias VS ..]
-
Maybe someone can suggest good approach:
I wrote my own Component that is a button. Different text property for each Component can bet set by - property alias text: someId.text - but what about if i want each Component to react differently on onClicked event from MouseArea?
-
You can add a signal to your component then emit it in onClicked of your MouseArea.
Something like this:
Button:
@
Rectangle {
width: 200
height: 200signal buttonClicked() MouseArea { anchors.fill: parent onClicked: buttonClicked() }
}
@Then when you want to use this component with a different reaction when clicked:
@
Button {
onButtonClicked: <your action here>
}
@ -
[quote author="Thanatos" date="1289674558"]Thanks man, this is great solution.[/quote]
Yay! You're welcome :-)