2333终于实现动图,先弄了一个窗口去掉标题栏假装就是启动画面了,还是那只萌萌的猫这次会动了!
基类用的是QWidget 类名称MainView
#ifndef MAINVIEW_H
#define MAINVIEW_H #include <QWidget>
#include <QGridLayout>
#include <QPushButton>
#include <windows.h>
#include <QApplication>
#include <QTimer> class MainView : public QWidget
{
Q_OBJECT
public:
explicit MainView(QWidget *parent = );
QGridLayout *main;
QPushButton *btn; signals:
void signals_WakeupApp(); private slots:
void slots_StopStartup();
void slots_WakeupApp(); private:
bool startupIsOver; }; #endif // MAINVIEW_H
mainview.h
#include "MainView.h"
#include <QDebug> MainView::MainView(QWidget *parent) :
QWidget(parent)
{
startupIsOver = false;
main = new QGridLayout(this);
btn = new QPushButton(tr("Just Button"));
main->addWidget(btn, , );
connect(this, SIGNAL(signals_WakeupApp()), this, SLOT(slots_WakeupApp()));
emit signals_WakeupApp();
Sleep(); } void MainView::slots_StopStartup()
{
startupIsOver = true;
} void MainView::slots_WakeupApp()
{ QTimer t;
connect(&t ,SIGNAL(timeout()), this, SLOT(slots_StopStartup()));
t.start();
while(!startupIsOver)
{
QApplication::processEvents();
}
}
mainview.cpp
#include <QApplication>
#include <QPixmap>
#include <QSplashScreen>
#include <QLabel>
#include <QMovie>
#include "MainView.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QMovie *movie; movie=new QMovie(":/new/prefix1/4");
QLabel *label=new QLabel("", );
label->setWindowFlags(Qt::FramelessWindowHint);
label->move(,);
label->setMovie(movie);
label->setScaledContents(true);
movie->start();
label->show();
MainView w;
w.show();
label->close();
return app.exec();
}
main.cpp