Qt Splash screen won't disappear



  • Hi all,

    I have created a splash screen image to show on running of the application I have tried to set it to a timer to automatically disappear but it just stays on screen until i click the centre of the splash screen then it disappears.

    can anyone help me? I'm a complete newbie to Qt

    @#include "mainwindow.h"
    #include <QApplication>
    #include <QSplashScreen>
    #include <QTimer>
    int main(int argc, char *argv[])
    {
    QApplication a(argc, argv);

    QSplashScreen *splash=new QSplashScreen;
    splash->setPixmap(QPixmap("/Users/Marcus/Calc/Images/Optics.jpg"));
    splash->show();
    
    MainWindow w;
    
    QTimer::singleShot(2500,splash,SLOT(close()));
    QTimer::singleShot(2500,splash,SLOT(show()));
    w.show();
    
    return a.exec&#40;&#41;;
    

    }
    @


  • Moderators

    Remove line 16. and it should work fine.


Log in to reply
 

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