47 lines
1.3 KiB
C++
47 lines
1.3 KiB
C++
#ifndef EPHOTO_H
|
|
#define EPHOTO_H
|
|
|
|
#include "ebase.h"
|
|
#include "pagelistitem.h"
|
|
|
|
class EPhoto : public EBase {
|
|
Q_OBJECT
|
|
public:
|
|
enum EnterStyle {
|
|
NoneStyle = 0,
|
|
Expanding2Left,
|
|
Expanding2Right,
|
|
Expanding2Top,
|
|
Expanding2Bottom,
|
|
ExpandingFromCenter
|
|
};
|
|
|
|
public:
|
|
static QString filters() { return tr("Images (*.png *.jpg *.jpeg *.bmp)"); }
|
|
static EPhoto *create(const QString &file, PageListItem *pageItem, EBase *multiWin = nullptr);
|
|
static EPhoto *create(const QJsonObject &, PageListItem *pageItem, EBase *multiWin = nullptr);
|
|
|
|
explicit EPhoto(const QImage&, const QString &dir, const QString &name, PageListItem *pageItem, EBase *multiWin = nullptr);
|
|
|
|
void scaleImgIfNeed();
|
|
|
|
int type() const override { return EBase::Photo; }
|
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
|
QJsonObject attrJson() const override;
|
|
void freeFiles() override;
|
|
void loadFiles() override;
|
|
bool save(const QString &pageDir) override;
|
|
QWidget* attrWgt() override;
|
|
|
|
QImage img;
|
|
QString mDir;
|
|
QString mName;
|
|
protected:
|
|
PageListItem *mPageItem;
|
|
int mDuration = 10;
|
|
int mEnterStyle = 0;
|
|
int mEnterDuration = 0;
|
|
};
|
|
|
|
#endif // EPHOTO_H
|