[Qt-interest] repaint()

Atlant Schmidt aschmidt at dekaresearch.com
Tue Sep 21 15:09:30 CEST 2010


Phil:

  I'm unclear on where the "data ready to be redrawn"
  has any opportunity to be effective. That is, when
  you're within the for loop, Qt is asked to do the
  repaint() and has the opportunity to do the repaint
  (when you call processEvents()), but what has actually
  changed that will paint any differently than the last
  time the loop invoked the repaint?

                         Atlant

-----Original Message-----
From: qt-interest-bounces at trolltech.com [mailto:qt-interest-bounces at trolltech.com] On Behalf Of phil prentice
Sent: Tuesday, September 21, 2010 08:39
To: qt-interest at trolltech.com
Subject: [Qt-interest] repaint()

Hi everyone

  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");
  }
}

The mechanism works very well except the repaint in the for loop does not do
anything.  I know this is probably a very basic question, but why??

Thankyou for your help

Phil
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest

This e-mail and the information, including any attachments, it contains are intended to be a confidential communication only to the person or entity to whom it is addressed and may contain information that is privileged. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited. If you have received this communication in error, please immediately notify the sender and destroy the original message.

Thank you.

Please consider the environment before printing this email.




More information about the Qt-interest-old mailing list