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

2023-10-25 Thread Ulf Hermann via Interest
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 you can avoid that exercise, you should avoid it. The usual way to declare a QML singleton is j

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

2023-10-25 Thread Stefan Seefeld
Hello, I'm trying to "modernize" a large code base that just migrated from Qt5 to Qt6. Our code is using a few singleton objects that used to be exported into the QML runtime via `qmlRegisterSingletonInstance()`. But as it is now recommended to move away from `qmlRegisterType()` (in favour of lett

Re: [Interest] QEvent::Quit vs. QEvent::Close

2023-10-25 Thread Tor Arne Vestbø via Interest
Hi, Can you elaborate on why you need to distinguish a quit from the Dock vs one initiated by qApp->quit()? See https://bugreports.qt.io/browse/QTBUG-118533 Cheers, Tor Arne On 23 Oct 2023, at 21:05, Alexander Dyagilev wrote: Hello, In Qt 5.x we had QEvent::Close when the user was using Doc

Re: [Interest] QEvent::Quit vs. QEvent::Close

2023-10-25 Thread Volker Hilsheimer via Interest
Indeed, you are right. I missed that QCoreApplicationPrivate::quit is virtual and overridden in QGuiApplicationPrivate to go through the QPA layer, which then looks for Qt like any other spontanous event. Created https://bugreports.qt.io/browse/QTBUG-118533 Not a high priority, as you can know

Re: [Interest] Problems with qt_add_qml_module

2023-10-25 Thread Ulf Hermann via Interest
Well ... maybe you want to read https://doc.qt.io/qt-6/qtqml-writing-a-module.html Actually, I like https://www.qt.io/blog/qml-modules-in-qt-6.2 better because it contains some history and motivation for why QML modules are what they are. For the actual examples, better refer to doc.qt.io, tho

Re: [Interest] Problems with qt_add_qml_module

2023-10-25 Thread Ulf Hermann via Interest
The first argument to the `qt_add_qml_module()` function is *not* a new target to be defined by the call. You can also give it an existing target. See all our examples that first create an executable target and then attach a QML module to it. Furthermore, the `SOURCES` argument isn't a list o