Dear all,

- I have a SplashScreen form with a progressBar. and another class is doing processing in a large loop.

- the processing is emiting a signal that's connected to a slot in SplashScreen that updates progress-Bar value and calls processEvents()

- the problem is that when the processing loop was greater than 17,000,000 turns, progress takes over one hour in Mac OSX. however, the same loop took around 2 minutes in Windows and Linux.

Splashscreen.h

Qt Code:
  1. class SplashScreen : public QWidget
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. SplashScreen(QWidget *parent = 0);
  7. ~SplashScreen();
  8.  
  9. public slots:
  10. void progress(qint32) ;
  11. }
To copy to clipboard, switch view to plain text mode 

SplashScreen.cpp

Qt Code:
  1. void SplashScreen::progress(qint32 percent)
  2. {
  3. ui.progressBar->setValue(percent) ;
  4. qApp->processEvents() ;
  5. }
To copy to clipboard, switch view to plain text mode 

processing code:

Source code

Qt Code:
  1. connect(this, SIGNAL(progress(qint32)), splashScreenObj, SLOT(progress(qint32))) ;
  2. ...
  3. for(int i=0;i<count;++i)
  4. {
  5. ...
  6. int percent = (int)((i/count) * 100.0f)
  7. emit progress( percent) ;
  8. }
To copy to clipboard, switch view to plain text mode 

How can I solve that ?

Thanks in advance,

Ahmed Bedier