2022-08-25 18:37:24 +08:00
|
|
|
#ifndef ETIMER_H
|
|
|
|
#define ETIMER_H
|
|
|
|
|
|
|
|
#include <QTimer>
|
|
|
|
#include <QColor>
|
|
|
|
#include <QFont>
|
|
|
|
#include <QDateTime>
|
|
|
|
#include "ebase.h"
|
|
|
|
|
|
|
|
class ETimer : public EBase {
|
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
struct Data {
|
|
|
|
QDateTime targetTime;
|
|
|
|
QFont font;
|
|
|
|
QString text;
|
|
|
|
QColor textColor;
|
|
|
|
QColor backColor;
|
|
|
|
int duration = 10;
|
|
|
|
bool isDown;
|
|
|
|
bool isMultiline;
|
|
|
|
bool hasDay;
|
|
|
|
bool hasHour;
|
|
|
|
bool hasMin;
|
|
|
|
bool hasSec;
|
|
|
|
};
|
|
|
|
|
|
|
|
explicit ETimer(EBase *multiWin = nullptr);
|
2023-10-23 14:58:29 +08:00
|
|
|
explicit ETimer(const JObj &json, EBase *multiWin = nullptr);
|
2022-08-25 18:37:24 +08:00
|
|
|
|
|
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
|
|
|
int type() const override { return EBase::Timer; }
|
|
|
|
QWidget* attrWgt() override;
|
2023-10-23 14:58:29 +08:00
|
|
|
JObj attrJson() const override;
|
2022-08-25 18:37:24 +08:00
|
|
|
|
|
|
|
Data attr;
|
|
|
|
int secs = 0;
|
|
|
|
|
|
|
|
private:
|
|
|
|
void init();
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // ETIMER_H
|