
Originally Posted by
GioFX
did you set up a qrc file?
Thanks for your advice.
#include <QApplication>
#include <QSplashScreen>
//#include <QThread>
//#include<QTimer>
#include<ctime>
#include "mainwindow.h"
/*
class SleeperThread : public QThread
{
public:
static void msleep(unsigned long msecs)
{
QThread::msleep(msecs);
}
};
*/
int main(int argc, char *argv[])
{
splash
->setPixmap
(QPixmap(":/images/splash.png"));
splash->show();
//splash->showMessage( "Initializing..." );
// app.processEvents();
//......................
MainWindow mainWin;
splash->showMessage( "Creating Widgets Page..." );
app.processEvents();
splash->showMessage( "Creating Database Page..." );
app.processEvents();
splash->showMessage( "Creating Games Page..." );
app.processEvents();
// SleeperThread::msleep(2000);
time_t t;
t = time(NULL);
//QTimer::singleShot(2500, splash, SLOT(close()));
//QTimer::singleShot(2500, &mainWin, SLOT(show()));
mainWin.show();
while( difftime(time(NULL),t) < 5.0 ) { }
splash->finish(&mainWin);
delete splash;
return app.exec();
}
#include <QApplication>
#include <QSplashScreen>
//#include <QThread>
//#include<QTimer>
#include<ctime>
#include "mainwindow.h"
/*
class SleeperThread : public QThread
{
public:
static void msleep(unsigned long msecs)
{
QThread::msleep(msecs);
}
};
*/
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QSplashScreen *splash=new QSplashScreen;
splash->setPixmap(QPixmap(":/images/splash.png"));
splash->show();
//splash->showMessage( "Initializing..." );
// app.processEvents();
//......................
MainWindow mainWin;
splash->showMessage( "Creating Widgets Page..." );
app.processEvents();
splash->showMessage( "Creating Database Page..." );
app.processEvents();
splash->showMessage( "Creating Games Page..." );
app.processEvents();
// SleeperThread::msleep(2000);
time_t t;
t = time(NULL);
//QTimer::singleShot(2500, splash, SLOT(close()));
//QTimer::singleShot(2500, &mainWin, SLOT(show()));
mainWin.show();
while( difftime(time(NULL),t) < 5.0 ) { }
splash->finish(&mainWin);
delete splash;
return app.exec();
}
To copy to clipboard, switch view to plain text mode
This time, I changed my code and alse set up my qrc file. But the program just show a left top rectangle area of the program instead of the image. How can i make image show?
I will appreciate any reply. Thanks
Bookmarks