[Interest] sharing singleton instance between C++ and QML

Ulf Hermann ulf.hermann at qt.io
Thu Oct 26 14:55:43 CEST 2023


Dear Stefan,

I don't want to patronize you, but I know the person who has to handle 
your bug reports if things go south with whatever architecture you come 
up with. Such things have happened before. So, sorry if that came across 
in the wrong way.

Wrapping your C++ singleton into another object is not generally a huge 
architectural undertaking. However, if it is, you do get the create() 
method as escape hatch. An in-depth guide on singletons is in the works. 
For now you can look at it here:

https://codereview.qt-project.org/c/qt/qtdeclarative/+/510512/12/src/qml/doc/src/qmlsingletons.qdoc

best regards,
Ulf


More information about the Interest mailing list