QT 대기 대화 상자/진행률 --

1200 단어 QT
QT의gif 그림을 불러옵니다.잊어버리지 않도록 기록해 두세요.
#ifndef DIALOG_H
#define DIALOG_H

#include 
#include 
#include
#include

class Dialog : public QDialog
{
    Q_OBJECT

public:
    explicit Dialog(QWidget *parent = 0);
    ~Dialog();

private:
    QMovie *movie;
    QLabel *label;
};

#endif // DIALOG_H
#include"dialog.h"

Dialog::Dialog(QWidget*parent):
    QDialog(parent)
{
    label = new QLabel(this);
    this->setFixedSize(200,200);
    setWindowOpacity(0.5);  // ;
    this->setWindowFlags(Qt::Dialog|Qt::CustomizeWindowHint);

    // 
    //this->setWindowFlags(Qt::Dialog|Qt::FramelessWindowHint);

    // 
    //this->setAutoFillBackground(true);
    this->setContentsMargins(0,0,0,0);
    label->setContentsMargins(0,0,0,0);
    /*QPalettepalette;palette.setBrush(QPalette::Background,QBrush(QPixmap("E:/qml/imgdialog/loading.gif")));
    this->setPalette(palette)*/;
    movie = new QMovie("loading.gif");
    label->setMovie(movie);
    movie->start();
}
Dialog::~Dialog()
{
    delete label;
    delete movie;
}

효과:

좋은 웹페이지 즐겨찾기