Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Update the text of a label during the button click handler

Update the text of a label during the button click handler

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.6k Views 1 Watching
  • 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.
  • D Offline
    D Offline
    DarwinIcesurfer
    wrote on last edited by
    #1

    How do you update the text of a label on the main window during the handling of a button click event. For example if I wanted to the elapsed time that the code in the button handler took to execute on a label on the main window, how would that be done?

    In my Microsoft Visual C# background I would update the text property of the label ie. this.txtMyLabel.Text="Some New Time";

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      And this is how you do it in Qt as well, you set the text property of the label.
      @
      label->setText("Some New Time");
      @
      If you want to measure the time elapsed use "QElapsedTimer":http://qt-project.org/doc/qt-4.8/qelapsedtimer.html.

      See also "Getting Started With Qt":http://qt-project.org/doc/qt-4.8/gettingstartedqt.html.

      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