程序启动画面
- screen.h
- screen.cpp
- main.cpp
- 运行图
-
screen.h
#ifndef SCREEN_H
#define SCREEN_H
#include <QMainWindow>
class Screen : public QMainWindow
{
Q_OBJECT
public:
Screen(QWidget *parent = nullptr);
~Screen();
};
#endif
screen.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
#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();
}
运行图
启动图片
启动后程序