-
Notifications
You must be signed in to change notification settings - Fork 0
/
imageviewer.h
77 lines (55 loc) · 1.46 KB
/
imageviewer.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
68
69
70
71
72
73
74
75
76
77
#ifndef IMAGEVIEWER_H
#define IMAGEVIEWER_H
#include <QMainWindow>
#include <QLabel>
#include <QScrollArea>
#ifndef QT_NO_PRINTER
#include <QPrinter>
#endif
namespace Ui {
class ImageViewer;
}
class ImageViewer : public QMainWindow
{
Q_OBJECT
public:
explicit ImageViewer(QWidget *parent = nullptr);
~ImageViewer();
private slots:
void dropEvent(QDropEvent *event);
void dragEnterEvent(QDragEnterEvent *event);
void on_actionOpen_triggered();
void on_actionPrint_triggered();
void on_actionExit_triggered();
void on_actionZoomIn_triggered();
void on_actionZoomOut_triggered();
void on_actionNormalSize_triggered();
void on_actionFitToWindow_triggered();
void on_actionAboutQt_triggered();
void on_actionSaveAs_triggered();
private:
Ui::ImageViewer *ui;
QImage image;
QLabel *imageLabel;
QScrollArea *scrollArea;
QAction *openAct;
QAction *saveAsAct;
QAction *printAct;
QAction *exitAct;
QAction *zoomInAct;
QAction *zoomOutAct;
QAction *normalSizeAct;
QAction *fitToWindowAct;
QAction *aboutQtAct;
double scaleFactor;
void updateActions();
void scaleImage(double factor);
void adjustScrollBar(QScrollBar *scrollBar, double factor);
void setImage(const QImage &newImage);
bool saveFile(const QString &fileName);
bool loadFile(const QString &fileName);
#ifndef QT_NO_PRINTER
QPrinter printer;
#endif
};
#endif // IMAGEVIEWER_H