44 lines
963 B
C
44 lines
963 B
C
|
#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);
|
||
|
explicit ETimer(const QJsonObject &json, EBase *multiWin = nullptr);
|
||
|
|
||
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||
|
int type() const override { return EBase::Timer; }
|
||
|
QWidget* attrWgt() override;
|
||
|
QJsonObject attrJson() const override;
|
||
|
|
||
|
Data attr;
|
||
|
int secs = 0;
|
||
|
|
||
|
private:
|
||
|
void init();
|
||
|
};
|
||
|
|
||
|
#endif // ETIMER_H
|