QSplashScreen用QThead定时

来源:互联网 发布:淘宝上哪家光威是正品 编辑:程序博客网 时间:2024/05/01 02:44

不重载QSplashScreen也可以实现定时,用QThead的sleep方法,不过需要封装成public 的方法

class I : public QThread{public:static void sleep(unsigned long secs) {QThread::sleep(secs);}};int main(int argc, char *argv[]){QApplication a(argc, argv);QTextCodec *codec = QTextCodec::codecForLocale();QTextCodec::setCodecForCStrings(codec);QTextCodec::setCodecForTr(codec);//Initial Welcome screenQSplashScreen *splash = new QSplashScreen(QPixmap(":/image/title.png"));splash->show();Qt::Alignment topRight = Qt::AlignRight | Qt::AlignTop;splash->showMessage("loading modules...",topRight,Qt::black);mainFrame *mFrame  = new mainFrame;LaunchWin launchWin(mFrame);I::sleep(3);splash->finish(&launchWin);launchWin.show();return a.exec();}


0 0