Qt 开机界面上无法显示文字信息
想给自己的qt程序搞个开机画面,网上百度了方法都一致,就是用QSplashScreen类来添加启动界面。
开机画面添加也是十分顺利,但是想在界面上显示一些如“正在加载。。。”之类的信息,都没有成功,在桌面还是ARM板上都不能显示。
下面是main函数里的代码,不知道哪里错误了,希望大侠们帮我看看:
QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/icons/pics/splash.png"));
splash->show();
Qt::Alignment topRight = Qt::AlignTop | Qt::AlignRight;
splash->showMessage(QObject::tr("Setting up the main window..."), topRight, Qt::red);
sleep(2);
mainwindow w;
splash->showMessage(QObject::tr("Loading modules..."), topRight, Qt::white);
sleep(2);
w.show();
splash->finish(&w);