Q_PROPERTY Vs Q_INVOKABLE
-
Hi,
Can anyone help me with the understanding of Q_PROPERTY and Q_INVOKABLE.
I am really trying to understand what are the advantages and disadvantages of using these two properties? When i can go for Q_PROPERTY and Q_INVOKABLE?Also i understand that :
Q_INVOKABLE is used to make functions accessible throughout Qt meta object system. Q_PROPERTY is much more complex and offers additional features.But when it comes for selection of these two properties then which one i can use in my application? If i am following MVC pattern then what will be the best way to proceed?
-
@QtQmlLearner said in Q_PROPERTY Vs Q_INVOKABLE:
Q_INVOKABLE is used to make functions accessible throughout Qt meta object system
Yes, that's all it does,
Q_PROPERTY has more possibilities to access members of a class: you can define setter and getter, notifications and more. So, what to select really depends on what you need. If you only want to make a method invocable then use Q_INVOKABLE, if you need something like a property with getter/setter/... then use Q_PROPERTY.