[Interest] How to avoid qml engine repeatedly copying and garbage collecting qstringlists?
Frank Mertens
frank at cyblogic.de
Mon Oct 23 15:17:56 CEST 2023
On 10/23/23 11:41, NIkolai Marchenko wrote:
> Qt 5.15.2
>
> I've encountered a strange behaviour while trying to pass the output of QFontDatabase::families() into qml via Q_PROPERTY of a singleton class.
> Essentially - I have a ton of qml items accessing this property in their initialization and every one of them is doing an .includes search on it.
>
> What happened is it has produced an absolutely massive slowdown and after perfing what's happening there it seems like qml engine is repeatedly recreating this stringlist inside the engine and garbage collecting it on every access instead of keeping it around. Is there something that can be done about it and what is even happening there?
>
Sounds to me, you are looking for a QStringListModel.
Cheers,
Frank
More information about the Interest
mailing list