4 ms·
how does it know that onClicked: count++ should be evaluated on a click and not save count into onClicked and increment it afterward?
by k__ 9y ago
how does it know that onClicked: count++ should be evaluated on a click and not save count into onClicked and increment it afterward?
- jcelerier 9y ago`onClicked` isn't a field. The Button object has, somewhere in its definition: signal clicked() ... /* on some raw mouse event handler */ { clicked(); } Then, when `clicked()` is called, if you have put somewhere in your code `onClicked: { some JS expression }`, the expression you put there will be called. Unlike JS objects, fields cannot be reassigned. Instead properties and signals are declared beforehand. property real count signal foo(arg1, arg2) ...