[Interest] Pointers as Q_PPOPERTY

Николай Шатохин n.shatokhin at gmail.com
Wed Oct 2 16:12:51 CEST 2013


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131002/046dc02e/attachment.html>


More information about the Interest mailing list