Details
-
Bug
-
Resolution: Unresolved
-
P3: Somewhat important
-
None
-
6.9
-
None
Description
When using QML linter with the default parameter, on a customized SpinBox with contentItem (see code below), then the linter posts a warning about the textFromValue being used. The use of the textFromValue property should be in line with our documentation, and, therefore, it shouldn't trigger a warning. The subsequent fix as a response to the linter warning may make the code worse (at least when done with Sonnet 4 LLM).
Code analysed by linter:
import QtQuick
import QtQuick.Controls.Basic
SpinBox {
id: spinBox
from: 0
to: 100
value: 50
stepSize: 1
width: 150
height: 40
background: Rectangle
contentItem: TextInput
up.indicator: Rectangle {
x: spinBox.mirrored ? 0 : parent.width - width
height: parent.height / 2
width: 30
color: spinBox.up.pressed ? "#e0e0e0" : (spinBox.up.hovered ? "#f5f5f5" : "transparent")
border.color: "#cccccc"
border.width: spinBox.up.pressed ? 1 : 0
Text
}
down.indicator: Rectangle {
x: spinBox.mirrored ? 0 : parent.width - width
y: parent.height / 2
height: parent.height / 2
width: 30
color: spinBox.down.pressed ? "#e0e0e0" : (spinBox.down.hovered ? "#f5f5f5" : "transparent")
border.color: "#cccccc"
border.width: spinBox.down.pressed ? 1 : 0
Text
}
}
Linter warning:
Warning: /var/folders/7q/0ftm5_g54b91ck89ym4wjycr0000gp/T/tmpdy4vuuom.qml:22:23: Property "textFromValue" is a QJSValue property. It may or may not be a method. Use a regular Q_INVOKABLE instead. [use-proper-function]
text: spinBox.textFromValue(spinBox.value, spinBox.locale)
^^^^^^^^^^^^^