[SOLVED] Update label when an button is pressed.



  • 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?



  • 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.



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

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.