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

NIkolai Marchenko enmarantispam at gmail.com
Mon Oct 23 16:56:06 CEST 2023


Oh, I see, yeah, that makes sense. Just singleton a wrapper,

The question though is whether this would be a singleton per qmlengine. If
it will, then that's a nogo as the list of loaded fonts needs to exist once
regardless of how much engines are running

On Mon, Oct 23, 2023 at 5:51 PM Ulf Hermann <ulf.hermann at qt.io> wrote:

> > 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
>     ...
> }
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20231023/03fabafc/attachment.htm>


More information about the Interest mailing list