Splash Screen in Qt


/ Published in: C++
Save to your folder(s)



Copy this code and paste it in your HTML
  1. /* Splash screen is made 90% in main Function*/
  2.  
  3. //make QPixmap
  4. QPixmap pix(":/1");
  5. //create QSplashScreen
  6. QSplashScreen *splash=new QSplashScreen;
  7. //make Splash has Image
  8. splash->setPixmap(pix);
  9. //SHOW Splash
  10. splash->show();
  11. // NOW u can call ur code that u wanna exec in-disguise behind Splash ;)
  12.  
  13. MainWindow w;
  14. for(int i=0;i<900000;i++)
  15. for(int j=0;j<900;j++);
  16.  
  17. //where u need to display text written in Splash like LOADING...
  18. Qt::Alignment mms=Qt::AlignBottom | Qt::AlignLeft;
  19. //the msg itself
  20. splash->showMessage("Setting up the main window...",mms, Qt::gray);
  21.  
  22. for(int i=0;i<900000;i++)
  23. for(int j=0;j<900;j++);
  24.  
  25. w.show();
  26. splash->finish(&w);

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.