| 1 |
/************************************************************************* |
| 2 |
* Copyright (c) 2011 AT&T Intellectual Property |
| 3 |
* All rights reserved. This program and the accompanying materials |
| 4 |
* are made available under the terms of the Eclipse Public License v1.0 |
| 5 |
* which accompanies this distribution, and is available at |
| 6 |
* https://www.eclipse.org/legal/epl-v10.html |
| 7 |
* |
| 8 |
* Contributors: Details at https://graphviz.org |
| 9 |
*************************************************************************/ |
| 10 |
|
| 11 |
#pragma once |
| 12 |
|
| 13 |
#define QT_NO_PRINTER 1 |
| 14 |
|
| 15 |
#include <QtWidgets> |
| 16 |
#include <QMainWindow> |
| 17 |
#include <QPrinter> |
| 18 |
|
| 19 |
QT_BEGIN_NAMESPACE |
| 20 |
class QAction; |
| 21 |
class QLabel; |
| 22 |
class QMenu; |
| 23 |
class QScrollArea; |
| 24 |
class QScrollBar; |
| 25 |
class MdiChild; |
| 26 |
QT_END_NAMESPACE |
| 27 |
|
| 28 |
class ImageViewer : public QMainWindow |
| 29 |
{ |
| 30 |
Q_OBJECT |
| 31 |
|
| 32 |
public: |
| 33 |
ImageViewer(); |
| 34 |
MdiChild* graphWindow; |
| 35 |
QMdiSubWindow* subWindowRef; //reference to its wrapping sub window |
| 36 |
public slots: |
| 37 |
bool open(const QString &fileName); |
| 38 |
void print(); |
| 39 |
void zoomIn(); |
| 40 |
void zoomOut(); |
| 41 |
void normalSize(); |
| 42 |
void fitToWindow(); |
| 43 |
void about(); |
| 44 |
|
| 45 |
|
| 46 |
private slots: |
| 47 |
|
| 48 |
private: |
| 49 |
void createActions(); |
| 50 |
void createMenus(); |
| 51 |
void updateActions(); |
| 52 |
void scaleImage(double factor); |
| 53 |
void adjustScrollBar(QScrollBar *scrollBar, double factor); |
| 54 |
|
| 55 |
QLabel *imageLabel; |
| 56 |
QScrollArea *scrollArea; |
| 57 |
double scaleFactor; |
| 58 |
|
| 59 |
#ifndef QT_NO_PRINTER |
| 60 |
QPrinter printer; |
| 61 |
#endif |
| 62 |
|
| 63 |
QAction *openAct; |
| 64 |
QAction *printAct; |
| 65 |
QAction *exitAct; |
| 66 |
QAction *zoomInAct; |
| 67 |
QAction *zoomOutAct; |
| 68 |
QAction *normalSizeAct; |
| 69 |
QAction *fitToWindowAct; |
| 70 |
QAction *aboutAct; |
| 71 |
QAction *aboutQtAct; |
| 72 |
|
| 73 |
QMenu *viewMenu; |
| 74 |
protected: |
| 75 |
void closeEvent(QCloseEvent *event); |
| 76 |
|
| 77 |
}; |