qt/LedOK/wProgramManager/wEditProgram/wElement/edclock.h

72 lines
1.9 KiB
C
Raw Normal View History

2022-01-04 18:11:48 +08:00
#ifndef EDCLOCK_H
#define EDCLOCK_H
#include <QPainter>
#include <QTextDocument>
#include <QTimeZone>
#include <QDate>
#include <QTime>
#include <QTimer>
#include "eobject.h"
class eDClock : public eObject
{
Q_OBJECT
public:
struct Data {
QByteArray timeZoneId;
bool year;
bool month;
bool day;
bool hour;
bool min;
bool sec;
bool weekly;
bool fullYear;
bool hour12;
bool AmPm;
int dateStyle;
int timeStyle;
bool multiline;
QString fontFamily;
int fontSize;
bool fontBold;
bool fontItalics;
bool fontUnderline;
QColor textColor;
int playDuration=10;
QString strHtml;
};
public:
explicit eDClock(QRectF rectInit,InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr);
explicit eDClock(const QJsonObject &json, InteractiveType type = Dynamic, QGraphicsItem *parent = nullptr);
private:
void init();
void CreateAllWordPic(QString strPath);
void CreateWordPic(QString strWord,QString strFileName,QString strPath);
public:
static void setElement(const QJsonObject &json, Data &attr);
public:
virtual void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
virtual int type() const override { return eObject::DClock; }
virtual QWidget* wAttr() override;
virtual QWidget* wAttrElement() override;
virtual QJsonObject save(const QString &pRoot) override;// { Q_UNUSED(pRoot); return elementJson(); }
virtual QJsonObject elementJson() const override;
signals:
public slots:
void onAttrChanged(const eDClock::Data &data);
private:
Data m_attr;
QString m_pRootPath="";
};
#endif // EDCLOCK_H