> If you store the value of the property in a var

So do I use `pragma Singleton` to wrap a c++ singleton into a qml one
declaring such a var property?

On Mon, Oct 23, 2023 at 5:37 PM NIkolai Marchenko <enmarantis...@gmail.com>
wrote:

> >  If you cannot port to Qt6 and compile the QML code to C++
>
> Unfortunately qt6 broke too much of Qt Quick 1 that porting will require
> non trivial effort.
>
> On Mon, Oct 23, 2023 at 5:35 PM Ulf Hermann <ulf.herm...@qt.io> wrote:
>
>> > So, should I send the value from qml to c++ to do a search there
>> > instead? It's the solution I ended up doing but I hoped storing
>> > something on JS side was possible to not cross language boundaries on
>> > each item initialization.
>>
>> If you cannot port to Qt6 and compile the QML code to C++, this may be
>> one of the rare cases where you might use a var property in QML. If you
>> store the value of the property in a var, the list wrapper is stored,
>> not only the list value. Whenever you access it from elsewhere, the
>> engine will use the same list wrapper again.
>>
>> In Qt6 you can use a list<string> instead of var for the same effect,
>> but with type.
>>
>> (At least this is how it should work. I don't think we have a test for
>> this particular case. So, if it doesn't work, please file a bug)
>>
>> best regards,
>> Ulf
>>
>
_______________________________________________
Interest mailing list
Interest@qt-project.org
https://lists.qt-project.org/listinfo/interest

Reply via email to