[Development] QTBUG-43096 - QML instantiation performance decadence

Tomasz Olszak olszak.tomasz at gmail.com
Mon Jul 23 12:52:46 CEST 2018


Hi,
I'm resurrecting this thread because it showed me that I can do more
with QML (registerConverters).
The only missing part was to allow developer to register converter
from his custom metatype to QML. I often ended up with making 2
properties e.g:

QList<Gadget> cppProperty
QVariantList qmlProperty

the API was ugly, etc.

Then I realized that if we already handle QVariant properly in QML
then why not to allow app developer to register converter to e.g.
QList<Gadget> -> QVariant
And use it in QML engine.

I made this simple patch and tested that it works, and is totally
enough for my needs. It make my API clean, If I need big performance I
do not use QList but rather create model.
However for simple, UI, cases it s a great benefit.

https://codereview.qt-project.org/#/c/235051

I haven't spent much time on it, probably data from "void *data =
QMetaType::create(property.propType());" needs to be deleted after
conversion. I is:f you find the solution acceptable I can polish it
with your help.

Now the main question is: what's wrong with this approach? Would it
break QML compiler? I don't see it having big performance issues
because a lot of app developer does the same but just inside their app
code.

pon., 4 cze 2018 o 19:46 Uwe Rathmann <Uwe.Rathmann at tigertal.de> napisaƂ(a):
>
> Hi Tomek,
>
> > I quickly reviewed QSkinny and it really nicely exposes C++ to Qml. I
> > can't see however, how you made e.g. QskVariant::stops readable from
> > Qml. Writing stops is possible due to QMetaType::registerConvertes, but
> > how you can iterate overs stop from Qml?
>
> Don't know either, but I'm not the right person to ask when it comes to
> JavaScript related issues.
>
> > PS: I also tried to have the same implementation for C++ and Qt Qml and
> > now some classes contains duplicated getters/setters (QVariantList
> > instead of QVector<C++Type>).
>
> Hope it is o.k. to throw in some ideas/experiences, but as my work is not
> part of the qt-project I don't want to to misuse this mailing list.
>
> But if you ( or anyone else ) likes to discuss in more depth what I'm
> doing you can always contact me of the list.
>
> ciao,
> Uwe
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development



More information about the Development mailing list