-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpixmapelement.h
67 lines (47 loc) · 1.37 KB
/
pixmapelement.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#ifndef PIXMAPELEMENT_H
#define PIXMAPELEMENT_H
#include <QGraphicsItem>
#include <QPixmap>
#include <QRectF>
#include <QRunnable>
#include "baseelement.h"
class PixmapNode;
class Loader;
class BaseSpace;
class PixmapElement : public BaseElement
{
QPixmap m_pixmap;
QString m_originName;
bool m_loading;
Loader * m_loader;
public:
enum { Type = UserType + GRAPHICSITEM_TYPE_PIXMAP };
int type() const override
{
// Enable the use of qgraphicsitem_cast with this item.
return Type;
}
PixmapElement(BaseElement * parent,
BaseSpace * space,
QRectF initRect = QRectF(0,0,100,100)
);
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option,
QWidget *widget) override;
void load();
void loadPixmap();
inline QString originalName() const {return m_originName;}
inline void setOriginalName(const QString & value) {m_originName = value;}
inline QPixmap pixmap() const { return m_pixmap;}
private slots:
void startLoad();
void finishLoad(bool);
void updateProgress(int progress);
};
class PixmapOpenJob : public QRunnable
{
PixmapElement * m_element;
public:
PixmapOpenJob(PixmapElement * element);
void run() override;
};
#endif // PIXMAPELEMENT_H