[Qt-interest] Label is not getting updated with text at runtime when there is a function call in between

chandrasekar wagmare sekarwagmare at gmail.com
Sat Feb 14 10:38:02 CET 2009


when calling the setText() the QLabel paintEvent() will call update()
function to schedule a repaint .. that repaint will not done right then ,
but rather when Qt has time for it after slot/event has finished and control
flow returned to Qt event loop .

 for long running slot:
        ->extact the long running operation in to threads
        ->periodically call QCoreApplication::processEvent()

try this link ...

 http://doc.trolltech.com/qq/qq27-responsive-guis.html

On Fri, Feb 13, 2009 at 8:24 PM, <wim.delvaux at adaptiveplanet.com> wrote:

> On Friday 13 February 2009 14:06:16 Ender EREL wrote:
> > Hemalatha Venkataswamy wrote:
> > > Hi,
> > >
> > > I have an application developed in Qt's whose main window is of
> QWidget.
> > > I have a label in my mainwindow which should get updates with text at
> > > runtime when I have some functions executed/not executed. Even though
> my
> > > control passes the function 'settext()' for the label and continues
> with
> > > a function call. The label will not be updated on the main window till
> > > the function call is ended
> > >
> > > Can anyone please suggest me answers/solution.
> >
> > My guess is this: The call to setText() updates the internal text of
> > QLabel, but this text is not redrawn on the screen until the function
> > returns and event loop issues a paint event.
> >
> > You may try calling label->repaint() to issue an immediate repaint and
> > make the label redraw itself.
>
> or processEvents for qApp
>
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>



-- 
CHANDRU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090214/8bcb7542/attachment.html 


More information about the Qt-interest-old mailing list