QML property assign is after the C++ constructor??
-
Hi,
Creating a object in QML using c++ class, does the property binding and assign happen after the C++ constructor?
@
class MyClass: public QObject
{
//...
Q_PROPERTY(QString name READ GetName WRITE SetName)Public:
MyClass(){
//...I must use the name in the constructor, But failed , the property name is assigned after the constructor.
}}
//QML file
MyClass{
name: "Harlen"
}
@the name: "Harlen" assign happens after the C++ Constructor.
:)
-
Hi,
I'm not sure if it will be useful in your case, but "QDeclarativeParserStatus":http://doc.qt.nokia.com/4.7-snapshot/qdeclarativeparserstatus.html will let you know when all properties have been set on the object, if you need to e.g. delay certain actions until that happens.
Regards,
Michael