Q_GADGET vs Q_OBJECT
I can use Q_GADGET or Q_OBJECT to expose C++ object into QML.
If my object can be implemented through Q_GADGET, that is no need of inheritance of QObject and no need of signals, which one should I use?
Should I always prefer Q_GADGET to Q_OBJECT whenever possible?
Or, is it always better to use Q_OBJECT than Q_GADGET?
If it depends on situation, what would decide better one?
Q_GADGET is more or less the MOC part of Q_OBJECT.
So if you can live without the features provided by QObject class you are good to go.
Q_GADGET does not allow signal
In that case, I'll stick to Q_GADGET as much as possible. Thank you!
I've already mentioned 'no need of signals'. Thank you.
if you are forced to use QObjects derives instead, you most probably will get compile errors anyway.