Updating a text field from onClicked twice not working

  • I'm trying to make a connect button with QML. When the user touches the connect button I'd like to change a status text field to "Connecting..." and change it to "Connected" after the connection has been established or to an error message if the connection failed. The problem is that the text field is never set to "Connecting...". Here is the relevant snippet from my code:
    MouseArea {
    id: btnConnect
    anchors.fill: parent
    onClicked: {
    textStatus.text = "Connecting..."
    textStatus.text = driver.connect_()

    If I don't set textStatus.text to the return value of driver.connect_(), textStatus.text is set to "Connecting..." after the connection have been established. How can I set the text field to something before the connection is established?

Log in to reply