程序启动画面
screen.h
cpp
#ifndef SCREEN_H
#define SCREEN_H
#include <QMainWindow>
class Screen : public QMainWindow
{
Q_OBJECT
public:
Screen(QWidget *parent = nullptr);
~Screen();
};
#endif // SCREEN_H
screen.cpp
cpp
#include "screen.h"
#include <QTextEdit>
#include <windows.h>
Screen::Screen(QWidget *parent)
: QMainWindow(parent)
{
setWindowTitle(tr("Splash Example"));
QTextEdit* Edit = new QTextEdit(tr("Splash Example"));
setCentralWidget(Edit);
resize(600,450);
Sleep(3000);
}
Screen::~Screen() {}
main.cpp
cpp
#include "screen.h"
#include <QApplication>
#include <QPixmap>
#include <QSplashScreen>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QPixmap PixMap("text.png");
QSplashScreen Splash(PixMap);
Splash.show();
a.processEvents();//展示画面 界面 然可以响应鼠标等操作
Screen w;
w.show();
Splash.finish(&w);
return a.exec();
}