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

2023-10-26 Thread Ulf Hermann via Interest
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 obje

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

2023-10-26 Thread Stefan Seefeld
On Thu, Oct 26, 2023 at 2:53 AM Ulf Hermann via Interest < interest@qt-project.org> wrote: > The very common misconception I keep reading over and over is that C++ > singletons should be the same as QML singletons. They generally aren't. > You can shoehorn a C++ singleton into a QML one, but if yo

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

2023-10-26 Thread Mike Trahearn via Interest
Thanks Ulf. QTBUG-116432 wasn't the thing I'd alluded to, actually it was something I came across with some older code which had also the use of Q_GLOBAL_STATIC which demands public ctors. The QML engine did not call the supplied create function but the public ctor. The same class having its in

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

2023-10-26 Thread Ulf Hermann via Interest
For the record it is actually possible (I proved it) to create multiple instances of the same singleton with only one engine using a singleton published from C++ if you concoct your C++ side, um,  poorly. But that's another matter for people stuck before C++11... I've fixed QTBUG-116432 if tha

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

2023-10-26 Thread Mike Trahearn via Interest
Hi Ulf, You have mentioned this foot gun (the create method ) to me before also. But you have only ever broadcast your dislike for the gun. Please could you explain why it is not a good idea to have single singletons. So far your "duplicate it in a wrapper" is not very nice way for maintenance b