what is reason to use both public slots and a Q_INVOKABLE method. As I can call slots from qml as well and also I can use Q_INVOKABLE method to connect signal.
Unsolved
QML and Qt Quick
-
@KYADAV It is explained here: https://doc.qt.io/qt-5/qobject.html
Q_INVOKABLE is used to be able to call methods of a class using https://doc.qt.io/qt-5/qmetaobject.html#invokeMethod -
The difference is just a convention now. Both slots and Q_INVOKABLE can be called by
invokeMethod
and meta-object system. Slots can have a return type.What I usually do is use slots for function that modify the state of the object and invokable for helpers returning or transforming data, usually taking some parameters.