Details
-
Bug
-
Resolution: Done
-
P3: Somewhat important
-
4.7.2
-
None
-
Windows XP, Linux
Description
There seems to be a bug when using QDeclarativeEngine/QDeclarativeExpression inside a function, and calling this function multiple times with the same QObject. The QObject's proprties are detected for the first use of a QDeclarativeEngine but not for the second use.
This can be solved by either using a pointer to QDeclarativeEngine or declaring it as static.
See attached the example demonstrating this problem. The second call to
void setName(QObject* pp_object, const QString& p_name)
creates an error message
"<Unknown File>: Error: Cannot assign to non-existent property "objectName""
Whereas multiple calls to either
void setNameStatic(QObject* pp_object, const QString& p_name)
and
void setNamePointer(QObject* pp_object, const QString& p_name)
work fine.