QT-Splash screen [ Solved ]



  • I am using qt 4.5.3 and i want to create a splash screen that disappears after ~5 seconds. i tried using sleep and other such structures, the splash screen activates and disappears on time but the image in the splash doesn't load, like in the case without the timer/sleep. Here is my code from the main.cpp, If anyone has any suggestions please help me out, :

    @
    /*

    • main.cpp
    • Created on: May 24, 2012
    •  Author: f-time
      

    */

    #include <QApplication>
    #include <QSplashScreen>
    #include<time.h>
    #include<iostream>
    #include "mainwindow.h"

    using namespace std;

    int main(int argc, char *argv[])
    {
    // Q_INIT_RESOURCE(application);
    QApplication app(argc, argv);
    QPixmap pixmap("splash.jpg");
    QSplashScreen *splash = new QSplashScreen(pixmap);
    splash->show();
    app.processEvents();
    app.setOrganizationName("Boss");
    app.setApplicationName("Can Application");
    MainWindow mainWin;

     mainWin.show();
    
    
     splash->finish(&mainWin);
     return app.exec(&#41;;
    

    }
    @

    [Edit: Be sure and wrap your code in @ tags; mlong]



  • Maybe "this code":https://qt-project.org/forums/viewthread/10075/ I posted a while ago is helpful to you.



  • Thank you. That bit of code just did the trick! and prompt answer too ^^



  • Glad I could help. Please edit the title of this thread by editing your first post in this thread and add [Solved] to the title. Thank you.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.