2022-08-25 18:37:24 +08:00
|
|
|
#ifndef EDCLOCK_H
|
|
|
|
#define EDCLOCK_H
|
|
|
|
|
2025-05-06 18:28:05 +08:00
|
|
|
#include "ebase.h"
|
|
|
|
#include "gutil/qgui.h"
|
2022-08-25 18:37:24 +08:00
|
|
|
#include <QPainter>
|
|
|
|
#include <QTextDocument>
|
|
|
|
#include <QTimeZone>
|
|
|
|
#include <QDate>
|
|
|
|
#include <QTime>
|
|
|
|
#include <QTimer>
|
|
|
|
|
2023-04-18 14:14:46 +08:00
|
|
|
class EDClock : public EBase {
|
2022-08-25 18:37:24 +08:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
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
|
|
|
|
2025-05-06 18:28:05 +08:00
|
|
|
QTimeZone timeZone;
|
|
|
|
QFont font = qfont("Arial", 12);
|
|
|
|
QColor color{Qt::red};
|
|
|
|
int dateStyle = 0;
|
|
|
|
int isSingleHour = 0;
|
|
|
|
int lineHeight = 0;
|
|
|
|
bool hasYear = true;
|
|
|
|
bool hasMonth = true;
|
|
|
|
bool hasDay = true;
|
|
|
|
bool hasHour = true;
|
|
|
|
bool hasMin = true;
|
|
|
|
bool hasSec = true;
|
|
|
|
bool hasWeek = true;
|
|
|
|
bool hasAmPm = true;
|
|
|
|
bool isFullYear = true;
|
|
|
|
bool is12Hour = true;
|
|
|
|
bool isMultiline = true;
|
2022-08-25 18:37:24 +08:00
|
|
|
private:
|
|
|
|
void init();
|
|
|
|
|
|
|
|
QString img_dir;
|
|
|
|
QDateTime datetime;
|
|
|
|
bool isSingleMD = false;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // EDCLOCK_H
|