which works fine. Then I wanted to clean the code up a little more, and
removed the "public:", given that the above is a `struct`, so everything
in it is public anyhow. And that's where it stopped working !
The Q_GADGET macro contains a "private:", just like the Q_OBJECT macro:
#define Q_GADGE
Oh wow, that's rude !
Thanks !
On Sat, Oct 28, 2023, 09:58 Constantin Makshin wrote:
> Hi Ulf.
>
> MOC is fine, it's the Q_GADGET macro:
> #define Q_GADGET_EXPORT(...) \
> public: \
> static __VA_ARGS__ const QMetaObject staticMetaObject; \
> void qt_check_for_QGADGET_macro(); \
>
Hi Ulf.
MOC is fine, it's the Q_GADGET macro:
#define Q_GADGET_EXPORT(...) \
public: \
static __VA_ARGS__ const QMetaObject staticMetaObject; \
void qt_check_for_QGADGET_macro(); \
typedef void QtGadgetHelper; \
private: \
QT_WARNING_PUSH \
Q_OBJECT_NO_ATTRIBUTES_WARNING \
Hi Uli,
thank you for sharing that document, that's indeed very helpful.
Following its examples, I was able to set up my singleton such that both
runtimes (C++, QML) would share the same instance.
Doing that I bumped into what I would consider a bug, probably in the MOC
infrastructure:
The example
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
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
__
From: Ulf Hermann
Sent: Thursday, October 26, 2023 7:53:17 PM
To: Mike Trahearn ; interest@qt-project.org
Subject: Re: [Interest] sharing singleton instance between C++ and QML
> For the record it is actually possible (I proved it) to create multiple
> instances of the same singleton
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
: interest@qt-project.org
Subject: Re: [Interest] sharing singleton instance between C++ and QML
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
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
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
11 matches
Mail list logo