Details
-
Bug
-
Resolution: Invalid
-
Not Evaluated
-
None
-
5.0.0
-
None
Description
void IopluginPlugin::initializeEngine(QDeclarativeEngine *engine, const char *uri) { QObject *fileObject = new QObject(); QJSValue fileValue = engine->newQObject(fileObject); engine->globalObject().setProperty("File", fileValue); qDebug() << "File value in the global object is:" << engine->globalObject().property("File").toString(); QJSValue str = engine->globalObject().property("String"); str.setProperty("File", fileValue); qDebug() << "File value in String object is:" << str.property("File").toString(); }
The below example prints out:
File value in the global object is: "" File value in String object is: "QObject(0x102501c60)"
It seems that it is not possible to write properties to the global object. Is the example code wrong or is this a bug?
Attachments
Issue Links
- is duplicated by
-
QTBUG-84341 ECMAScript / Javascript Engine builtin objects are immutable (frozen)
- Open
-
QTBUG-101298 Extending the Error class errors when trying to overwrite the `name` property
- Closed