Just call a special c++ function from script, that creates the object. Thats what the constructor function is anyway, when you have declared your own.

There, when you return the qobjects script value back using engine->newQObject(), just pass QtOwnership as parameter. Then script garbage collection will not delete your object.

If you need to use it in c++ code, you will have to find some way of accessing it. Just store a pointer/pointers to your object(s) when you create them.

HIH

Johannes