RecordControlApplication/Message.h

44 lines
865 B
C
Raw Normal View History

2024-03-04 16:22:40 +08:00
#ifndef MESSAGE_H
#define MESSAGE_H
#include <QLabel>
#include <QPair>
#include <QPushButton>
#include <QTimer>
#include <QWidget>
class Message : public QWidget {
Q_OBJECT
public:
enum Level {
Success,
Error,
Info,
Warning
};
explicit Message(QWidget* parent = 0);
~Message();
void success(QString content, int duration);
void error(QString content, int duration);
void info(QString content, int duration);
void warning(QString content, int duration);
private:
Level level = Info;
bool isShow = false;
int count = 0;
int maxCount = 5;
QList<QPair<QPushButton*, QTimer*>> contentList;
QString btnStyle;
private:
void showMessage(QString content, int duration, Level level);
QPushButton* generateButton(QString content, Level level);
};
#endif // MESSAGE_H