-- 
Kai Köhne, Senior Manager R&D | The Qt Company

The Qt Company GmbH, Rudower Chaussee 13, D-12489 Berlin
Geschäftsführer: Mika Pälsi, Juha Varelius, Tuula Haataja. Sitz der 
Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B

> -----Original Message-----
> From: Interest [mailto:interest-bounces+kai.koehne=qt...@qt-project.org]
> On Behalf Of Boudewijn Rempt
> Sent: Thursday, April 21, 2016 12:29 PM
> To: interest@qt-project.org
> Subject: [Interest] Adding existing QObjects to QJSEngine
> 
> I want to make Krita scriptable, maybe with QJSengine. I'm trying to give the
> js engine access to the existing objects in Krita: the images, documents,
> windows etc.
> 
> From the documentation, I though I would have to use
> QJSEngine.newQObject, but that takes ownership and deletes the objects as
> soon as the engine goes out of scope.

You should be able to change that with QQmlEngine::setObjectOwnership [1]

(yes, it's QQmlEngine, but I'd assume it works nevertheless also for QJSEngine 
instances).

Regards

Kai 

[1]: http://doc.qt.io/qt-5/qqmlengine.html#setObjectOwnership
_______________________________________________
Interest mailing list
Interest@qt-project.org
http://lists.qt-project.org/mailman/listinfo/interest

Reply via email to