[Qt-interest] repaint()

phil prentice philp.cheer at talktalk.net
Tue Sep 21 21:03:10 CEST 2010


On Tuesday 21 September 2010 17:49, Frank Lutz wrote:
> As i can remamber you do not need to repaint(), or update. The
> Application updates by itself.
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest

What I am doing is a bit different in that my App is stuck in a continuos for 
loop (talking to the hardware) and I have to force a repaint in order to 
update the screen.

Thanks
Phil
>   I would be grateful for a little help using paintEvent().  I have an
> application that has a "Continuous Button". I have implemented the slot
> using the following basic code.
> void VIwindow::continuousSlot()         // SLOT
> {
>   static bool running = false;
>   if(m_continuousButton->text() == "Stop")
>   {
>     running = false;
>     return;
>   }
>   else
>   {
>     running = true;
>     m_continuousButton->setText("Stop");
>     repaint();  // Force a direct update.   Works!!!
>     for(;;)
>     {
>        // Update some widgets with data ready to be redrawn
>       repaint();  // The widgets are not being drawn????
>       // Check for stop being pressed.
>       QCoreApplication::processEvents();
>        if(!running)
>          break;
>     }
>     m_continuousButton->setText("Continuous");
>   }
> }




More information about the Qt-interest-old mailing list