Results 1 to 3 of 3

Thread: Display qlabel text immediately

  1. #1
    Join Date
    Dec 2010
    Posts
    16
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Display qlabel text immediately

    Hello,

    I have a push button and a label in a dialog. When the push button is clicked, the program will start to do some calculation. The label is designed to display the status, such as initialization, in progress and completes, but the label is NOT updated immediately after it reaches settext(), I even tried to call repaint(), but still no luck. In the dialog, the label is always blank until coming to the end, then "Completes" is displayed.

    Can anyone help point out where is wrong and how to fix this? Thanks.

    Here is the code:

    Qt Code:
    1. void Test::on_start_Button_clicked()
    2. {
    3. ui->label_status->setText("Reading data from file ...");
    4. ui->label_status->repaint();
    5.  
    6. Do_1(); // function to do something
    7.  
    8. ui->label_status->setText("Action in progress ...");
    9. ui->label_status->repaint();
    10.  
    11. Do_2(); // function to do something
    12.  
    13. ui->label_status->setText("Completes.");
    14. ui->label_status->repaint();
    To copy to clipboard, switch view to plain text mode 
    Last edited by wysota; 4th February 2012 at 14:19. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Display qlabel text immediately

    [wiki]Keeping the GUI Responsive[/wiki]
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Dec 2010
    Posts
    16
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Display qlabel text immediately

    Thanks for the help, I got my gui working based on your suggestion.

Similar Threads

  1. display image in qlabel
    By aj2903 in forum Qt Programming
    Replies: 3
    Last Post: 3rd July 2014, 12:09
  2. Role to display QLabel?
    By hailflex in forum Newbie
    Replies: 1
    Last Post: 13th December 2009, 21:30
  3. display QImage on QLabel
    By akasi in forum Qt Programming
    Replies: 2
    Last Post: 23rd September 2008, 23:48
  4. Display QLabel in two lines
    By arunvv in forum Newbie
    Replies: 1
    Last Post: 8th February 2008, 06:25
  5. QListWidget::addItem and display immediately
    By vlg789 in forum Qt Programming
    Replies: 6
    Last Post: 24th September 2007, 16:30

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.