qt/LedOK/program/edclock.h
2024-02-21 18:08:50 +08:00

52 lines
1.1 KiB
C++

#ifndef EDCLOCK_H
#define EDCLOCK_H
#include <QPainter>
#include <QTextDocument>
#include <QTimeZone>
#include <QDate>
#include <QTime>
#include <QTimer>
#include "ebase.h"
class EDClock : public EBase {
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;
};
explicit EDClock(EBase *multiWin = nullptr);
explicit EDClock(const JObj &json, EBase *multiWin = nullptr);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
int type() const override { return EBase::DClock; }
QWidget* attrWgt() override;
JObj attrJson() const override;
private:
void init();
Data m_attr;
QString img_dir;
QDateTime datetime;
bool isSingleMD = false;
};
#endif // EDCLOCK_H