qt_demoe/core_qui/quimessagebox.h

70 lines
1.7 KiB
C++

#ifndef QUIMESSAGEBOX_H
#define QUIMESSAGEBOX_H
#include "quihead.h"
class QUIMessageBox : public QDialog
{
Q_OBJECT
public:
static QUIMessageBox *Instance();
explicit QUIMessageBox(QWidget *parent = 0);
~QUIMessageBox();
protected:
void showEvent(QShowEvent *);
void closeEvent(QCloseEvent *);
bool eventFilter(QObject *watched, QEvent *event);
private:
static QScopedPointer<QUIMessageBox> self;
QVBoxLayout *verticalLayout1;
QWidget *widgetTitle;
QHBoxLayout *horizontalLayout3;
QLabel *labIco;
QLabel *labTitle;
QLabel *labCountDown;
QWidget *widgetMenu;
QHBoxLayout *horizontalLayout4;
QPushButton *btnMenu_Close;
QWidget *widgetMain;
QVBoxLayout *verticalLayout2;
QFrame *frame;
QVBoxLayout *verticalLayout4;
QHBoxLayout *horizontalLayout1;
QLabel *labIcoMain;
QSpacerItem *horizontalSpacer1;
QLabel *labInfo;
QHBoxLayout *horizontalLayout2;
QSpacerItem *horizontalSpacer2;
QPushButton *btnOk;
QPushButton *btnCancel;
private:
int closeSec; //总显示时间
int currentSec; //当前已显示时间
private slots:
void initControl(); //初始化控件
void initForm(); //初始化窗体
void checkSec(); //校验倒计时
private slots:
void on_btnOk_clicked();
void on_btnMenu_Close_clicked();
public Q_SLOTS:
//设置左上角图标
void setIconMain(int icon, quint32 size = 12);
//设置消息图标 图形字体+图片两种方式
void setIconMsg(const QString &png, int icon);
//设置提示信息带类型和关闭倒计时
void setMessage(const QString &msg, int type, int closeSec = 0);
//自适应尺寸
void autoSize();
};
#endif // QUIMESSAGEBOX_H