[Development] Qt 5.2 Alpha possible issue with V4 and exposed Qml properties

Nils Jeisecke njeisecke at saltation.de
Fri Oct 11 18:16:07 CEST 2013

Hi Paul,

On Fri, Oct 11, 2013 at 5:29 PM, Paul Lemire <paullemire at hotmail.com> wrote:
> On a side note, those models are not registered as qml properties but are
> returned as QObject* in a Q_INVOKABLE methods of the backend. If I want to
> use the model in a ListView, I then do :
> ListView
> {
>         model : library_name.getMyModel();
>         ....
> }
When returning QObject* from invokable methods, the Qml engine takes
ownership by default. Your object probably gets destroyed at some

Use QQmlEngine::setObjectOwnership if this is not what you want.

Why aren't you providing your model pointers as read only properties instead?


More information about the Development mailing list