Change label text does not update on screen

asked 2015-04-15 10:51:31 +0300

pLurchi gravatar image

Hi there,

I'm in trouble because my label does not update it's changes in the second qml file (LinkSD.qml). In initial page (FirstPage.qml) it is working. By setting LinkSD.qml to initialpage it is also working on LinkSD.qml.

I don't see the mistake, because the textvalue of my label is changing. I can see that in the console log by hitting the button two times. But it is not updated on the screen.

my-app.qml

ApplicationWindow {
    initialPage: FirstPage {id: firstpage}
    //Additional components
    LinkSD {
    id: linksd
    }

    /*initialPage: LinkSD {id: linksd}
    //Additional components
    FirstPage {
    id: firstpage
    }*/


    Python {
    id: py

    Component.onCompleted: {

        setHandler('find_SD', function(txti) {
            console.log("qml find_SD 1: " + txti)
            console.log("qml find_SD 2: ")
            firstpage.label.text = "Label " + txti
            console.log("qml find_SD 3: " + linksd.sdLbl.text)
            linksd.sdLbl.text = "Label" + txti
            console.log("qml find_SD 4: " + linksd.sdLbl.text)

        });

    }
    }

}

FirstPage.qml

Page {
    id: page
    property alias label: label

    SilicaFlickable {

    Column{
    id: menuC
    Button {
            text: "Link SD Card"
            onClicked: pageStack.push(Qt.resolvedUrl("LinkSD.qml"))
    }

    Label {
            id: label
            text: "0"
    }
    }


    }
}

LinkSD.qml

Page {
    id: page
    property alias sdLbl: sdLbl

    SilicaFlickable {

    Column{
        id: menuC

        Button {
            text: "Find mountings"
            onClicked: py.call("main.find_SD",[sdLbl.text])
        }

        Label {
            id: sdLbl
            text: "nothing"
        }

    }

    }
}

main.py

def find_SD(txti):
    txti = "in find_SD"
    pyotherside.send("find_SD",txti)
edit retag flag offensive close delete