qt/LedOK/program/edclock.h

53 lines
1.2 KiB
C
Raw Normal View History

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;
int playDuration = 10;
};
2023-04-18 14:14:46 +08:00
explicit EDClock(EBase *multiWin = nullptr);
explicit EDClock(const QJsonObject &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;
QJsonObject attrJson() const override;
private:
void init();
Data m_attr;
QString img_dir;
QDateTime datetime;
bool isSingleMD = false;
};
#endif // EDCLOCK_H