2016-05-02 17:31 GMT+03:00 Jérôme Godbout <jer...@bodycad.com>:
> Hello Sina, this will not work (at least up to 5.5 as far as I know). > Cause QtObject doesn't have a default property to place children like Item > have. You would get the following error while parsing your script: > *Cannot assign to non-existent default property* > > You can either make a simple object that have the default property for > children and property parent like Items (here's the QmlObject) or simply > use the Item {} and get the extra position,dimension properties. > > class QmlObject : public QObject, public QQmlParserStatus > { > Q_OBJECT > Q_INTERFACES(QQmlParserStatus) > Q_CLASSINFO("DefaultProperty", "children"); > > Q_PROPERTY(QQmlListProperty<QObject> children READ children NOTIFY > childrenChanged STORED false); > Q_PROPERTY(QObject* parent READ parent WRITE set_parent NOTIFY > parentChanged STORED false); > > Q_PROPERTY(QString idName READ id_name NOTIFY idNameChanged STORED false); > ... > }; > > Thank you so much Jérôme, I like the idea that categorizing the constants. I was not aware that childing the QtObjects are not possible because of the default property. Also thank you for showing the basic structure for QmlObject.
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest