Qt-QSplashScreen-program startup animation,

Source: Internet
Author: User

Qt-QSplashScreen-program startup animation,

When most large applications are started, a startup screen is displayed before the program is fully started, and disappears after the program is fully started. The startup screen displays information about related products, it allows users to understand the product functions while waiting for the program to start. This is also a publicity method.

First run the interface

The following is the sample code.

Mainwindow. h

#ifndef MAINWINDOW_H#define MAINWINDOW_H#include 
 
  class MainWindow : public QMainWindow{    Q_OBJECTpublic:    MainWindow(QWidget *parent = 0);    ~MainWindow();};#endif // MAINWINDOW_H
 

Mainwindow. cpp

# Include "mainwindow. h" # include
 
  
# Include
  
   
MainWindow: MainWindow (QWidget * parent): QMainWindow (parent) {setWindowTitle ("program startup screen example"); QTextEdit * edit = new QTextEdit; edit-> setText ("program startup screen example"); setCentralWidget (edit); resize (600,450); Sleep (1000);} MainWindow ::~ MainWindow (){}
  
 

The most critical core code

Main. cpp

#include "mainwindow.h"#include 
 
  #include 
  
   #include 
   
    int main(int argc, char *argv[]){    QApplication a(argc, argv);    QPixmap pixmap("logo.jpg");    QSplashScreen splash(pixmap);    splash.show();    a.processEvents();    MainWindow w;    w.show();    splash.finish(&w);    return a.exec();}
   
  
 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.