[Interest] How to avoid qml engine repeatedly copying and garbage collecting qstringlists?
Ulf Hermann
ulf.hermann at qt.io
Mon Oct 23 19:58:18 CEST 2023
> doesn't QtQuickGuiProvider do the exact same thing with QfontDatabase::families?
Yes, it does. It returns a QStringList. What I mean is that you don't
need a custom C++ base class for your singleton if all you want to do is
expose the font families in pre-wrapped form. The following is enough
for that:
pragma Singleton
import QtQml
QtObject {
// Qt5:
property var wrappedFontFamilies5: Qt.fontFamilies()
// Qt6:
property list<string> wrappedFontFamilies6: Qt.fontFamilies()
}
More information about the Interest
mailing list