-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathimgviewer.h
60 lines (43 loc) · 1.22 KB
/
imgviewer.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
#ifndef IMGVIEWER_H
#define IMGVIEWER_H
#include <QGraphicsView>
#include <QGraphicsScene>
#include <QPixmap>
#include <QGraphicsPixmapItem>
#include <QImage>
#include <QPrinter>
class ImgViewer : public QGraphicsView
{
Q_OBJECT
public:
explicit ImgViewer(QWidget *parent = 0);
bool loadFile(const QString &strFilePath, QString &strError);
// bool loadFile(const QImage &image, QString &strError); TODO overload
void resetView();
void fitWindow();
void originalSize();
void rotateView(const int nVal);
void printView();
bool saveViewToDisk(QString &strError);
inline bool isModified() { return m_rotateAngle!=0; }
inline int getRotateAngle(){ return m_rotateAngle; }
QString getImageFormat(QString strFileName);
private:
mutable QImage m_image;
QPixmap m_pixmap;
QGraphicsPixmapItem *m_pixmapItem;
QGraphicsScene *m_scene;
int m_rotateAngle;
bool m_IsFitWindow;
bool m_IsViewInitialized;
QString m_fileName;
#ifndef QT_NO_PRINTER
QPrinter printer;
#endif
protected:
virtual void wheelEvent(QWheelEvent * event);
virtual void resizeEvent(QResizeEvent * event);
public slots:
void reactToFitWindowToggle(bool);
};
#endif // IMGVIEWER_H