Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Updating a text field from onClicked twice not working
QtWS25 Last Chance

Updating a text field from onClicked twice not working

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Scye
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved