Hi, On 25/01/2011, at 7:02 PM, ext Dumb Acnt wrote:
> Hi All, > > I had a quick QML question that I wanted to bounce off of you all. > > I was looking at the minehunt > [http://doc.qt.nokia.com/latest/demos-declarative-minehunt.html] Qt > declarative example and am able to see good application of this in my > application. > > However I have a slight deviation from the data structure point of view here. > I would like to make the TileData class in the minehunt example to be a > composition of other QObject derived classes which will also expose their > properties to the QML view. > > However I have failed to do so as once a class is make to derive from QObject > it can no longer be copied and hence can not have a READ Q_PROPERTY for the > QML view to come and read it. Unless I am assuming we make it a pointer. > However this as well does not seem to work for me. Here is what I am thinking > of about extending the TileData class. Yes, the property needs to be a pointer. The property declaration in TileData should look like this: Q_PROPERTY (TileType* tileType READ tileType NOTIFY tileTypeChanged) Also the TileType class must be registered using qmlRegisterType() in main.cpp, like it is for the TileData class. This part of the "Extending QML from C++" tutorial might be useful: http://doc.qt.nokia.com/4.7-snapshot/declarative-tutorials-extending-chapter4-custompropertytypes.html regards, Bea _______________________________________________ Qt-qml mailing list [email protected] http://lists.qt.nokia.com/mailman/listinfo/qt-qml
