-
Technical task
-
Resolution: Unresolved
-
P2: Important
qmllint (current dev) suggests to replace "var" property with function,
for code bellow.
Property "nextCheckState" is a variant property. It may or may not be a method. Use a regular function instead.
But this suggestion have no sense for me.
QML doesn't support function "override" in the same manner as C++, hence to allow user change part of logic of your component this logic should be inside property,
and only "var" type is allowed if you want to save "function() {}" inside property.
So how it possible to "use regular function instead" in such case ?
Rectangle {
id: control
property var nextCheckState: function(prevState) {
return !prevState;
}
BoolValue {
id: flag
}
MouseArea {
anchors.fill: parent
onClicked: {
flag.setOn(control.nextCheckState(flag.isOn));
}
}
}
- is blocked by
-
QTBUG-120295 Improvements to the QML type system
-
- Open
-
| For Gerrit Dashboard: QTBUG-104220 | ||||||
|---|---|---|---|---|---|---|
| # | Subject | Branch | Project | Status | CR | V |
| 599601,1 | WIP: reserve tag to mak properties as callable | dev | qt/qtbase | Status: NEW | -2 | 0 |