QT启动画面不显示

按照QSplashScreen 说明做了个测试程序,但启动画面看不到显示,程序进入了主窗口。测试程序如下:
#include <QApplication>
#include <QSplashScreen>
#include <QMainWindow>
int main(int argc, char *argv[]){
QApplication app(argc, argv);
QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/images/star.png"));
splash->show();
QMainWindow mainWin;
mainWin.show();
// splash->finish(&mainWin);
// delete splash;
return app.exec();
}

在网上看了一下,说是要加到qrc中。但我作的VS2005,于是手动将start.png添加到Resource Files这个文件夹中,发现还是不行。

又按网上说的 增加时延等,还是不行。

于量把qrc文件打开

<RCC>
<qresource>
    <file>images/icon.png</file>
    <file>images/new.png</file>
    <file>images/open.png</file>
    <file>images/save.png</file>
    <file>images/cut.png</file>
    <file>images/copy.png</file>
    <file>images/paste.png</file>
    <file>images/find.png</file>
    <file>images/gotocell.png</file>
     <file>images/splash.png</file>
</qresource>
</RCC>
发现原来要在这里添加啊。而VS2005不能自动添加。

添加后顺利启动。

posted on 2011-04-14 19:36  corecible  阅读(1508)  评论(2编辑  收藏  举报

导航