| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
#ifndef GRAPHICWINDOW_H |
| 24 |
#define GRAPHICWINDOW_H |
| 25 |
|
| 26 |
#include <QtWidgets> |
| 27 |
#include <QtPrintSupport/QPrinter> |
| 28 |
#include <QtPrintSupport/QPrintDialog> |
| 29 |
|
| 30 |
|
| 31 |
class GraphicWindow : public QWidget |
| 32 |
{ |
| 33 |
Q_OBJECT |
| 34 |
public: |
| 35 |
GraphicWindow(QWidget *parent); |
| 36 |
|
| 37 |
~GraphicWindow(); |
| 38 |
|
| 39 |
void openPng(QString fileName); |
| 40 |
|
| 41 |
private slots: |
| 42 |
void zoomIn(); |
| 43 |
void zoomOut(); |
| 44 |
void normalSize(); |
| 45 |
void fitToWindow(); |
| 46 |
void save(); |
| 47 |
void print(); |
| 48 |
|
| 49 |
protected: |
| 50 |
|
| 51 |
|
| 52 |
private: |
| 53 |
|
| 54 |
void createActions(); |
| 55 |
|
| 56 |
void updateActions(); |
| 57 |
void scaleImage(double factor); |
| 58 |
void adjustScrollBar(QScrollBar *scrollBar, double factor); |
| 59 |
|
| 60 |
QLabel *imageLabel; |
| 61 |
QScrollArea *scrollArea; |
| 62 |
double scaleFactor; |
| 63 |
|
| 64 |
QPrinter printer; |
| 65 |
|
| 66 |
QToolBar *m_toolbar; |
| 67 |
|
| 68 |
QAction *saveAct; |
| 69 |
QAction *printAct; |
| 70 |
QAction *exitAct; |
| 71 |
QAction *zoomInAct; |
| 72 |
QAction *zoomOutAct; |
| 73 |
QAction *normalSizeAct; |
| 74 |
QAction *fitToWindowAct; |
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
QMenu *fileMenu; |
| 79 |
QMenu *viewMenu; |
| 80 |
QMenu *helpMenu; |
| 81 |
}; |
| 82 |
|
| 83 |
#endif |