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. [SOLVED] Update label when an button is pressed.
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Update label when an button is pressed.

Scheduled Pinned Locked Moved General and Desktop
signal & slot
3 Posts 2 Posters 1.3k Views 2 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.
  • M Offline
    M Offline
    majesticfuck
    wrote on last edited by majesticfuck
    #1

    Hi,

    I have this class: http://pastebin.com/PfFPQZES
    And methods implementation: http://pastebin.com/ERdQY0n5

    What I want to do, is when I press acceptButton to: 1) insert data in DB 2) update label with query status and wait 2sec 3) close that window.
    The problem is that the label is not updating... when I press acceptButton nothing happens with that label :(

    Any ideas?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      when you use QLabel::setText() you change only the internal status of the object but the refresh will happens only when the control returns to the EventLoop; this is why you don't see the label changes.

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • M Offline
        M Offline
        majesticfuck
        wrote on last edited by majesticfuck
        #3

        Ok, and how I 'refresh' the object immediately after method call?

        EDIT: qApp->processEvents() after QLabel::setText() did the trick, thanks!

        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