Important: Please read the Qt Code of Conduct -

Cannot assign to non-existent property

  • Hello everybody,

    I create a qml file Bar with the code:

    Bar.qml :

    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 :
                bottom : parent.bottom
                margins: topMenuBarGI.modelHorizontalMargin

    and in my main.qml I do :

    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 text

    property alias titleText : machineModelText


    titleText.font.pixelSize: 10
    titleText.text : "Hello"

    edit : but what you did works also for me..

  • Qt Champions 2017

    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

Log in to reply