[Interest] How to avoid qml engine repeatedly copying and garbage collecting qstringlists?

Ulf Hermann ulf.hermann at qt.io
Mon Oct 23 16:51:10 CEST 2023


> How is instantiating a new c++ instance each time faster than 
> referencing a c++ side singleton??

This is not what I meant. I mean:

// singletonbase.h
class SingletonBase : public QObject
{
     Q_OBJECT
     QML_ELEMENT
     // Not a singleton!
     Q_PROPERTY( ... )
public:
     Q_INVOKABLE ...
};

// Singleton.qml
pragma Singleton
import TheModuleThatHasSingletonBase

SingletonBase {
    property var fontFamilies: find.the.font.families
    ...
}


More information about the Interest mailing list