Results 1 to 5 of 5

Thread: refresh QLabel text

  1. #1
    Join Date
    May 2015
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default refresh QLabel text

    Hello,

    I have a simple question about Qlabel, I was googled for this question and I didin´t find any satisfactory solution. The question is :

    If I try to change the text in a QLabel, the text appears onto the older text.

    My code is :


    sprintf (str, " frame rate %3d fps", cont_frames);

    ui->label_frame_rate->setText (str);

    ui->label_frame_rate->update();


    This code is called every 1 secon, so the older text in the label is not removed.

    Anyone can help me ?

    Advenced thanks

  2. #2
    Join Date
    Mar 2008
    Location
    Kraków, Poland
    Posts
    1,536
    Thanked 284 Times in 279 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: refresh QLabel text

    What the program does at this time ? To update GUI event loop can not be locked.

  3. #3
    Join Date
    May 2015
    Posts
    3
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: refresh QLabel text

    The program is running with different threads visualizing points cloud in real time and I don't have any problem, the only problem I have is with the QLabel, the text appears overwritten.

  4. #4
    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: refresh QLabel text

    Quote Originally Posted by dragonprog View Post
    the only problem I have is with the QLabel, the text appears overwritten.
    This would indicate you have more than one label in the same position.
    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.


  5. #5
    Join Date
    Sep 2014
    Posts
    18
    Thanks
    2
    Qt products
    Platforms
    Unix/X11 Windows

    Default Re: refresh QLabel text

    Qt 4.8

    ui->label_frame_rate->clear();
    ui->label_frame_rate->setText (str);

Similar Threads

  1. geting QLabel text ontop of other QLabel displaying image
    By krystosan in forum Qt Programming
    Replies: 1
    Last Post: 15th December 2013, 18:35
  2. refresh image in a Qlabel
    By prkhr4u in forum Newbie
    Replies: 12
    Last Post: 22nd October 2013, 08:49
  3. Replies: 2
    Last Post: 14th January 2011, 16:09
  4. QLabel text and ElideMode (...)
    By Talei in forum Newbie
    Replies: 3
    Last Post: 8th May 2010, 19:54
  5. Squeeze text in QLabel
    By jiveaxe in forum Qt Programming
    Replies: 5
    Last Post: 6th September 2007, 11:45

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.