45 lines
1.0 KiB
C
45 lines
1.0 KiB
C
|
|
#ifndef LOADINGDIALOG_H
|
||
|
|
#define LOADINGDIALOG_H
|
||
|
|
|
||
|
|
#include <QDialog>
|
||
|
|
#include <QGraphicsDropShadowEffect>
|
||
|
|
#include <QLabel>
|
||
|
|
#include <QMovie>
|
||
|
|
#include <QPainter>
|
||
|
|
#include <QPushButton>
|
||
|
|
#define USER_CANCEL -1
|
||
|
|
|
||
|
|
// LoadingDialog 改造来源:https://blog.csdn.net/weixin_42105886/article/details/114665272
|
||
|
|
class LoadingDialog : public QDialog
|
||
|
|
{
|
||
|
|
Q_OBJECT
|
||
|
|
public:
|
||
|
|
explicit LoadingDialog(QWidget* parent = nullptr);
|
||
|
|
~LoadingDialog();
|
||
|
|
// 设置提示文本
|
||
|
|
void setTipsText(QString strTipsText);
|
||
|
|
// 设置是否显示取消等待按钮
|
||
|
|
void setCanCancel(bool bCanCancel);
|
||
|
|
// 移动到指定窗口中间显示
|
||
|
|
void moveToCenter(QWidget* pParent);
|
||
|
|
|
||
|
|
protected:
|
||
|
|
void paintEvent(QPaintEvent* event) override;
|
||
|
|
|
||
|
|
private:
|
||
|
|
void initUi();
|
||
|
|
|
||
|
|
Q_SIGNALS:
|
||
|
|
void cancelWaiting();
|
||
|
|
|
||
|
|
private slots:
|
||
|
|
void cancelBtnClicked();
|
||
|
|
|
||
|
|
private:
|
||
|
|
QFrame* m_pCenterFrame;
|
||
|
|
QLabel* m_pMovieLabel;
|
||
|
|
QMovie* m_pLoadingMovie;
|
||
|
|
QLabel* m_pTipsLabel;
|
||
|
|
QPushButton* m_pCancelBtn;
|
||
|
|
};
|
||
|
|
#endif // LOADINGDIALOG_H
|