qt/LedOK/wProgramManagerA/wprogramitema.h
2022-01-04 18:11:48 +08:00

61 lines
1.8 KiB
C++

#ifndef WPROGRAMITEMA_H
#define WPROGRAMITEMA_H
#include <QObject>
#include <QTreeWidget>
#include <QTreeWidgetItem>
#include <QDir>
#include <QDateTime>
#include <QJsonObject>
#include <QJsonDocument>
#include <QPushButton>
#include <LoQClass/loqpushbutton.h>
#include <LoQClass/loqtreewidget.h>
class wProgramItemA : public QObject, public QTreeWidgetItem
{
Q_OBJECT
Q_PROPERTY(QString name MEMBER m_name READ name WRITE setName NOTIFY nameChanged )
Q_PROPERTY(int number MEMBER m_number READ number WRITE setNumber NOTIFY numberChanged )
Q_PROPERTY(int fsize MEMBER m_fsize READ fsize WRITE setFsize NOTIFY fsizeChanged )
Q_PROPERTY(QDateTime last MEMBER m_last READ last WRITE setLast NOTIFY lastChanged )
public:
explicit wProgramItemA(const QString &pRoot, const QString &name, int number, LoQTreeWidget *parent = nullptr);
explicit wProgramItemA(const QString &pRoot, const QJsonObject &json, LoQTreeWidget *parent = nullptr);
private:
void init();
public:
void save();
void del();
QJsonObject jRoot();
public:
QString name() const { return m_name; }
int number() const { return m_number; }
qint64 fsize() const { return m_fsize; }
QDateTime last() const { return m_last; }
public:
void setName(const QString &s) { m_name = s; }
void setNumber(int n) { m_number = n; }
void setFsize(qint64 n) { m_fsize = n; }
void setLast(const QDateTime &s) { m_last = s; }
signals:
void nameChanged(const QString &);
void numberChanged(int);
void fsizeChanged(quint64);
void lastChanged(const QDateTime &);
private:
QString m_name;
int m_number;
qint64 m_fsize;
QDateTime m_last;
};
#endif // WPROGRAMITEMA_H