Unsolved Cannot assign to non-existent property
-
Hello everybody,
I create a qml file Bar with the code:
Bar.qml :
Item{ property alias titleText : machineModelText.text property alias setPixelSize : machineModelText.font.pixelSize Text { id: machineModelText //font.pixelSize: 20 font.capitalization: Font.AllUppercase color: topMenuBarGI.modelTextColor verticalAlignment: Text.AlignVCenter horizontalAlignment: Text.AlignLeft anchors { left: parent.left top : parent.top bottom : parent.bottom margins: topMenuBarGI.modelHorizontalMargin } } }
and in my main.qml I do :
Bar{ setPixelSize : 10 titleText : "Hello" }
It works for titleText but not for setPixelSize, I have the error message : Cannot assign to non-existent property "setPixelSize", why ?
thanks for your help
-
@cosmoff hi,
try to alias only the textproperty alias titleText : machineModelText
then
Bar{ titleText.font.pixelSize: 10 titleText.text : "Hello" }
edit : but what you did works also for me..
-
Alias cannot be reference to grouped property.
-
I did :
titleText.font.pixelSize: 10 titleText.text : "Hello"
but I have the error message : Invalid grouped property access
So what can I do ? -
@cosmoff I see nothing wrong in the code. Please verify whether are you referring to the right Bar.qml and also, whether it has property setPixelSize defined.
-
it works, the code was good but I had a problem with a library.
thanks a lot for your help