QJSEngine::newQObject ownership

  • Hello,

    I want to register GUI objects like the QMainWindow in my QJSEngine.
    Is there a way to set the ownership like in QScriptEngine::newQObject?
    I don't want QJSEngine to take the ownership, because I destroy the engine before I destroy the GUI.

    Thanks in advance


  • I finally found a "solution".

    The documentation says QJSEngine::newQObject uses JavaScriptOwnership.
    But: this is only the case for QObjects that do not have a parent.

    So i just set a dummy parent to my objects and now it works.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.