Hi Michael

id is a special property that you cannot use as a property - 
http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeintroduction.html#object-identifiers

What I did in a similar situation, I added a property to a Button that was 
controlling what the Button is to do.
Basically I was creating buttons for a calculator-like app, so each Button had 
a property of "value" or something like this. Then it had a signal 
clicked(value).

If you do want to use something like id, you'll have to clone it, i.e. add a 
new property that would contain same value. That is more error-prone in the 
long-run, however.

BR,
Artem.

On Aug 24, 2011, at 3:53 PM, [email protected] wrote:

> Hello, I'm new with QML and just wondering that I can't access the id of a 
> QML parent object if I work with the MouseArea and the onClicked signal.
> 
> What I did is creating a QML Button definition which I want to use in 
> multiple other QML Objects.
> 
> So I want to to reuse the Button instead duplicating the code.
> 
> If the button is clicked it's important to know in which parent QML Object 
> the button was embedded. I need this to run different actions depending on 
> the parent object. 
> 
> What is the trick to get the parent id?
> 
> Best regards Michael
> _______________________________________________
> Qt-qml mailing list
> [email protected]
> http://lists.qt.nokia.com/mailman/listinfo/qt-qml

_______________________________________________
Qt-qml mailing list
[email protected]
http://lists.qt.nokia.com/mailman/listinfo/qt-qml

Reply via email to