-
Notifications
You must be signed in to change notification settings - Fork 3
/
imageviewer.h
111 lines (80 loc) · 2.27 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#ifndef IMAGEVIEWER_H
#define IMAGEVIEWER_H
#include <QMainWindow>
#include <QLabel>
#include <QScrollArea>
#include <QDockWidget>
#include <QButtonGroup>
#include <QSystemTrayIcon>
#ifndef QT_NO_PRINTER
#include <QPrinter>
#include <QMouseEvent>
#endif
namespace Ui {
class ImageViewer;
}
class ImageViewer : public QMainWindow
{
Q_OBJECT
public:
explicit ImageViewer(QWidget *parent = nullptr);
~ImageViewer();
private slots:
void dropEvent(QDropEvent *event) override;
void dragEnterEvent(QDragEnterEvent *event) override;
void wheelEvent(QWheelEvent *event) override;
void closeEvent(QCloseEvent *event) override;
void on_activatedSysTrayIcon(QSystemTrayIcon::ActivationReason reason);
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();
void optionGroups_clicked();
void on_actionAbout_triggered();
private:
Ui::ImageViewer *ui;
QIcon *icon;
//! range-map visualization concerned
QImage raw_image; // raw image
QImage image; // pcolor
QLabel *imageLabel;
QScrollArea *scrollArea;
QButtonGroup *optionGroups;
QDockWidget *dock;
//! system tray concerned
QSystemTrayIcon *systemTray;
QMenu *trayMenu;
QAction *minimumAct;
QAction *maximumAct;
QAction *restoreAct;
QAction *quitAct;
//! menu bar concerned
QAction *openAct;
QAction *saveAsAct;
QAction *printAct;
QAction *exitAct;
QAction *zoomInAct;
QAction *zoomOutAct;
QAction *normalSizeAct;
QAction *fitToWindowAct;
QAction *aboutQtAct;
double scaleFactor;
bool loadFile(const QString &fileName);
void updateActions();
void scaleImage(double factor);
void adjustScrollBar(QScrollBar *scrollBar, double factor);
void setImage(const QImage &newImage);
bool saveFile(const QString &fileName);
void createDockWindows();
void idPcolor();
// void resizeEvent(QResizeEvent*);
#ifndef QT_NO_PRINTER
QPrinter printer;
#endif
};
#endif // IMAGEVIEWER_H