PDA

View Full Version : refresh QLabel text



dragonprog
1st June 2015, 12:38
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

Lesiok
1st June 2015, 12:46
What the program does at this time ? To update GUI event loop can not be locked.

dragonprog
1st June 2015, 12:59
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.

wysota
1st June 2015, 14:19
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.

Goodwin
4th June 2015, 07:57
Qt 4.8

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