您的位置:首页 > 编程语言 > Qt开发

QT启动画面不显示

2011-04-14 19:36 274 查看
按照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不能自动添加。

添加后顺利启动。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: