How do those crazy Q Macros work?
-
Hello fellow Qt Devs,
I do not quite understand how the so called "signal" can change value of a property(whatever hides behind that keyword) while there is no visible Object instance.
And what is the "FINAL" custom type meant for in the Q_PROPERTY signature cause it doesn't change the result.

-
Apparently the QML_SINGLETON macro the Singleton object is automatically created with default constructor when a QML Engine accesses it so thats why one can call its setters or whatever, at least it is said like that in the next video after the implementation
-
Hi,
You can find everything around Q_PROPERTY in this chapter of the Qt documentation.
FINALmeans that you cannot shadow this property in a subclass. -
Hello fellow Qt Devs,
I do not quite understand how the so called "signal" can change value of a property(whatever hides behind that keyword) while there is no visible Object instance.
And what is the "FINAL" custom type meant for in the Q_PROPERTY signature cause it doesn't change the result.

@DSpUz said in How do those crazy Q Macros work?:
there is no visible Object instance.
There IS an object instance! The singleton is an instance.
I do not quite understand how the so called "signal" can change value of a property
A NOTIFY signal tells the QML engine to discard the old (cached) property value and read it again.
When your
Globalssingleton (instance) emits thenumberChangedsignal, the QML engine re-readsGlobals.numberand updates thetext. -
D DSpUz has marked this topic as solved on