Details
-
Suggestion
-
Resolution: Unresolved
-
P2: Important
-
6.7.1
-
None
Description
I've tried qmllint for the coffee machine example in Qt 6.7.1 and got so many errors which are difficult to fix just based on the provided error message. If it's so difficult even for Qt employees, it would be much more difficult for new Qt users to actually fix the issues pointed out by qmllint.
Here's one example:
Error: C:/Qt/Examples/Qt-6.7.1/demos/coffee/Insert.qml:6:5: 'continueButton' is used but it is not resolved [unresolved-type] continueButton.onClicked: applicationFlow.continueButton() ^^^^^^^^^^^^^^ Error: C:/Qt/Examples/Qt-6.7.1/demos/coffee/Insert.qml:7:5: 'cancelButton' is used but it is not resolved [unresolved-type] cancelButton.onClicked: applicationFlow.cancelButton()
It says "continueButton" cannot be resolved.
When you check Insert.qml, you see this code:
InsertForm { continueButton.onClicked: applicationFlow.continueButton() cancelButton.onClicked: applicationFlow.cancelButton() }
cancelButton is atually declared in InsertForm.ui.qml:
CustomButton { id: cancelButton Layout.alignment: Qt.AlignHCenter | Qt.AlignTop Layout.minimumWidth: 150 Layout.minimumHeight: 40 showIcon: false buttonText: "Cancel" }
and it's aliased like so:
Item { id: root property alias continueButton: continueButton property alias cancelButton: cancelButton
This seems to be totally okay and I personally cannot figure out how I'm supposed to resolve this issue.
Here's another example:
Error: C:/Qt/Examples/Qt-6.7.1/demos/coffee/Home.qml:7:9: Property "grid.states" does not exist [missing-property]
State {
^^^^^
When you check Home.qml, you see this code:
HomeForm {
grid.states: [
State {
name: "small"
when: ((Screen.height * Screen.devicePixelRatio)
+ (Screen.width * Screen.devicePixelRatio)) < 2000
PropertyChanges {
target: header
font.pixelSize: 28
}
PropertyChanges {
target: caption
font.pixelSize: 14
}
}
]
}
HomeForm.ui.qml has grid inside:
Item { id: home property alias getStartedbutton: getStartedButton property alias grid: grid property alias header: header property alias caption: caption
and grid is GridLayout which inherits Item therefore has to have states property:
GridLayout { id: grid anchors.horizontalCenter: parent.horizontalCenter anchors.top: home.top flow: GridLayout.TopToBottom Image { id: image
Again, I cannot understand how I can resolve this issue.
Attachments
Issue Links
- depends on
-
QTBUG-118112 Create doc pages that explain how to fix qmllint/qmlsc warnings (take 2)
- Open