2022-08-25 18:37:24 +08:00
|
|
|
#ifndef EDCLOCK_H
|
|
|
|
#define EDCLOCK_H
|
|
|
|
|
|
|
|
#include <QPainter>
|
|
|
|
#include <QTextDocument>
|
|
|
|
#include <QTimeZone>
|
|
|
|
#include <QDate>
|
|
|
|
#include <QTime>
|
|
|
|
#include <QTimer>
|
|
|
|
#include "ebase.h"
|
|
|
|
|
2023-04-18 14:14:46 +08:00
|
|
|
class EDClock : public EBase {
|
2022-08-25 18:37:24 +08:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
struct Data {
|
|
|
|
QByteArray timeZoneId;
|
|
|
|
QFont font;
|
|
|
|
QColor textColor;
|
|
|
|
bool year;
|
|
|
|
bool month;
|
|
|
|
bool day;
|
|
|
|
bool hour;
|
|
|
|
bool min;
|
|
|
|
bool sec;
|
|
|
|
bool weekly;
|
|
|
|
bool fullYear;
|
|
|
|
bool hour12;
|
|
|
|
bool AmPm;
|
|
|
|
bool multiline;
|
|
|
|
int dateStyle;
|
|
|
|
int timeStyle;
|
|
|
|
};
|
|
|
|
|
2023-04-18 14:14:46 +08:00
|
|
|
explicit EDClock(EBase *multiWin = nullptr);
|
2023-10-23 14:58:29 +08:00
|
|
|
explicit EDClock(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::DClock; }
|
|
|
|
QWidget* attrWgt() override;
|
2023-10-23 14:58:29 +08:00
|
|
|
JObj attrJson() const override;
|
2022-08-25 18:37:24 +08:00
|
|
|
|
|
|
|
private:
|
|
|
|
void init();
|
|
|
|
|
|
|
|
Data m_attr;
|
|
|
|
QString img_dir;
|
|
|
|
QDateTime datetime;
|
|
|
|
bool isSingleMD = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EDCLOCK_H
|