qt/LedOK/program/ephoto.h

33 lines
1002 B
C
Raw Normal View History

2022-08-25 18:37:24 +08:00
#ifndef EPHOTO_H
#define EPHOTO_H
#include "ebase.h"
#include "pagelistitem.h"
class EPhoto : public EBase {
Q_OBJECT
public:
static QString filters() { return tr("Images (*.png *.jpg *.jpeg *.bmp)"); }
static EPhoto *create(const QString &file, PageListItem *pageItem, EBase *multiWin = nullptr);
2023-10-23 14:58:29 +08:00
static EPhoto *create(const JObj &, PageListItem *pageItem, EBase *multiWin = nullptr);
2022-08-25 18:37:24 +08:00
explicit EPhoto(const QImage&, const QString &dir, const QString &name, PageListItem *pageItem, EBase *multiWin = nullptr);
void scaleImgIfNeed();
2024-02-21 18:08:50 +08:00
int type() const override { return EBase::Image; }
2022-08-25 18:37:24 +08:00
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
2023-10-23 14:58:29 +08:00
JObj attrJson() const override;
2022-08-25 18:37:24 +08:00
void freeFiles() override;
void loadFiles() override;
bool save(const QString &pageDir) override;
QWidget* attrWgt() override;
QImage img;
2024-02-21 18:08:50 +08:00
QString mDir, mName;
2022-08-25 18:37:24 +08:00
protected:
PageListItem *mPageItem;
};
#endif // EPHOTO_H