Hi, I've searched for this and haven't found it, so I thought I'd share this little code.

If you want a dummy splash screen (that is, your main window can start immediately but you want the splash screen to stay a couple of seconds) you can use the following code:

Qt Code:
  1. #include <QtGui/QApplication>
  2. #include <QSplashScreen>
  3. #include "mainWND.h"
  4.  
  5. int main(int argc, char *argv[])
  6. {
  7. QApplication a(argc, argv);
  8. QPixmap pixmap(":/mainWND/Resources/splash.png");
  9. QSplashScreen splash(pixmap,Qt::WindowStaysOnTopHint);
  10. mainWND w;
  11. w.setWindowOpacity(0);
  12. w.show();
  13. splash.show();
  14. QTimer::singleShot(2000, &splash, SLOT(close()));
  15. QTimer::singleShot(2000, &w, SLOT(slInit()));
  16.  
  17. return a.exec();
  18. }
To copy to clipboard, switch view to plain text mode 

And define a slot in your main window called slInit (or whatever you want to call it) where you put the following code:

Qt Code:
  1. void mainWND::slInit()
  2. {
  3. setWindowOpacity(1);
  4. }
To copy to clipboard, switch view to plain text mode 

With this trick you can show your splash screen for some seconds, then make your main window appear. I have only tested it in Windows Vista, any feedback for other platforms would be great.

I hope this helps anyone, this forum has been a great source of info for my Qt programming and I thought I should give something back!