Details
-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.3.1
Description
With the following files I get this warning:
/usr/lib/qt6/bin/qmllint --compiler warning Test.qml Warning: Test.qml:6:16: Could not compile binding for onCompleted: Member someProp of QString of QString can be shadowed idRoot.idTest.someProp = "test"
Test.qml
import QtQuick TestForm { id: idRoot Component.onCompleted: { idRoot.idTest.someProp = "test" idRoot.idTest.otherProp = "test2" } }
TestForm.ui.qml
import QtQuick
Item {
property alias idTest: idTestComponent
TestComponent {
id: idTestComponent
}
}
TestComponent.qml
import QtQuick
Item {
property string someProp
property string otherProp
}
If I add '// qmllint disable' to the first assignment line in Test.qml, I do not get an error for the second line.
Moving Component.onComplete into TestForm.ui.qml silences the shadowing warning.
Qmllint seems to be aware of the properties though, as adding something like 'idRoot.idTest.badprop = "bad"' will give another warning and silence the shadowing warning.
The initial warning it self also seems a bit dubious as TestComponent is not a QString.