Return to Snippet

Revision: 28169
at July 3, 2010 03:59 by mms007


Updated Code
/* Splash screen is made 90% in main Function*/

    //make QPixmap
    QPixmap pix(":/1");
    //create QSplashScreen
    QSplashScreen *splash=new QSplashScreen;
    //make Splash has Image
    splash->setPixmap(pix);
    //SHOW Splash
    splash->show();
    // NOW u can call ur code that u wanna exec in-disguise behind Splash ;) 
    
    MainWindow w;
    for(int i=0;i<900000;i++)
        for(int j=0;j<900;j++);

    //where u need to display text written in Splash like LOADING...
    Qt::Alignment mms=Qt::AlignBottom | Qt::AlignLeft;
    //the msg itself
    splash->showMessage("Setting up the main window...",mms, Qt::gray);

    for(int i=0;i<900000;i++)
        for(int j=0;j<900;j++);

    w.show();
    splash->finish(&w);

Revision: 28168
at July 2, 2010 20:34 by mms007


Initial Code
/* Splash screen is made 90% in main Function*/

    //make QPixmap to have Splash Screen image
    QPixmap pix(":/1");
    //make instance from QSplashScreen
    QSplashScreen *splash=new QSplashScreen;
    
    splash->setPixmap(pix);
    //SHOW Splash
    splash->show();
    
   //HERE U CAN EXEC UR HEAVY CODE

   //MSG inside Splash
    Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;
    splash->showMessage("Setting up the main window...",topRight, Qt::blue);
    for(int i=0;i<900000;i++)
        for(int j=0;j<90;j++);

    //leave splash and refer to next widget
    splash->finish(&w);

Initial URL

                                

Initial Description

                                

Initial Title
Splash Screen in Qt

Initial Tags

                                

Initial Language
C++