Qt-interest Archive, March 2002
Problem Updating a QLabel in a widget
Message 1 in thread
Hello all.
I am having difficulties with this certain scanario:
I have a QLabel set in a parent Widget and the Qlabel has text applied to it
using simple code such as the following:
statusd= new QLabel(this);
statusd->setText("IDLE");
statusd->setGeometry(10,10,80,20);
statusd->setFont(QFont("Times",12,QFont::Bold));
The problem is that when I am in another family-member function other that
the widget function, statusd->setText("Running"); will not take a visual
affect until the program returns to the widget's function.
I've tried update(); and repaint(); but does not do any immediate changes
until the parent widget function is in focus again. By that point, update
and repaint would be uneccesary.
How can I change the text string in a Qlabel, or even QListbox, without
returning focus to the parent widget function to show the visual change?
I look forward to your advice.
Regards,
Frank
Message 2 in thread
Nevermind.
I fixed the issue by calling a repaint to the Qlabel point 'statusd' using a
Signal-n-Slot method.
Are there other ways too?
On Monday 11 March 2002 11:14 am, you wrote:
> Hello all.
>
> I am having difficulties with this certain scanario:
> I have a QLabel set in a parent Widget and the Qlabel has text applied to
> it using simple code such as the following:
>
> statusd= new QLabel(this);
> statusd->setText("IDLE");
> statusd->setGeometry(10,10,80,20);
> statusd->setFont(QFont("Times",12,QFont::Bold));
>
> The problem is that when I am in another family-member function other that
> the widget function, statusd->setText("Running"); will not take a visual
> affect until the program returns to the widget's function.
>
> I've tried update(); and repaint(); but does not do any immediate changes
> until the parent widget function is in focus again. By that point, update
> and repaint would be uneccesary.
>
> How can I change the text string in a Qlabel, or even QListbox, without
> returning focus to the parent widget function to show the visual change?
>
> I look forward to your advice.
>
> Regards,
> Frank