[Interest] Pointers as Q_PPOPERTY

Дмитрий Козлов gnitry at mail.ru
Wed Oct 2 17:37:51 CEST 2013


02.10.2013 19:18, Stephen Kelly пишет:
> On Wednesday, October 02, 2013 19:02:54 Дмитрий Козлов wrote:
>> 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.
> This will work with QML with Qt 5.2.
>
>   https://codereview.qt-project.org/#change,42703
>
> Before that, your Q_PROPERTY needs to be type QObject*.
>
> Thanks,
>
>
>
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
Yes. Didn't try in Qt 5. But in Qt 4.8.5 I use

/Q_PROPERTY(QObject * myObject READ myObject)/

and dynamic_cast in "set"-method.

PS: /Q_PROPERTY(MyObject * myObject READ myObject)///works, if MyObject 
derived from QAbstractListModel
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20131002/879c651e/attachment.html>


More information about the Interest mailing list