02.10.2013 18:12, Николай Шатохин пишет:
Hello

I registered as QML Type class Ship inherited from QObject that have fields:

Q_PROPERTY(Hull hull READ hull)
Q_PROPERTY(Reactor reactor READ reactor)
Q_PROPERTY(Shields shields READ shields)

(all field classes inherited from QObject too)

But in ship class I'm using this fields as pointers (Hull * hull). So, how to use correctly Q_Properties in this case? (I need call methods from this fields and catch signals from them in QML)

Can I use something like this Q_PROPERTY(Hull hull READ hull)?
And then in QML:

Ship
{
    id: ship
Hull
    {
 id: hull_indicator
 backend: ship.hull
    }

onDamage:
    {
ship.hull.reduce(damage);
    }
}

Best regards,
Nick


_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest
Maybe you looking for this (work with pointers) ?

Q_PROPERTY(Hull * hull READ hull)
Q_PROPERTY(Reactor * reactor READ reactor)
Q_PROPERTY(Shields * shields READ shields)

This approach should work in your case.
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to