imageviewer.h 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  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. #pragma once
  11. #define QT_NO_PRINTER 1
  12. #include <QtWidgets>
  13. #include <QMainWindow>
  14. #include <QPrinter>
  15. QT_BEGIN_NAMESPACE
  16. class QAction;
  17. class QLabel;
  18. class QMenu;
  19. class QScrollArea;
  20. class QScrollBar;
  21. class MdiChild;
  22. QT_END_NAMESPACE
  23. class ImageViewer : public QMainWindow
  24. {
  25. Q_OBJECT
  26. public:
  27. ImageViewer();
  28. MdiChild* graphWindow;
  29. QMdiSubWindow* subWindowRef; //reference to its wrapping sub window
  30. public slots:
  31. bool open(const QString &fileName);
  32. void print();
  33. void zoomIn();
  34. void zoomOut();
  35. void normalSize();
  36. void fitToWindow();
  37. void about();
  38. private slots:
  39. private:
  40. void createActions();
  41. void createMenus();
  42. void updateActions();
  43. void scaleImage(double factor);
  44. void adjustScrollBar(QScrollBar *scrollBar, double factor);
  45. QLabel *imageLabel;
  46. QScrollArea *scrollArea;
  47. double scaleFactor;
  48. #ifndef QT_NO_PRINTER
  49. QPrinter printer;
  50. #endif
  51. QAction *openAct;
  52. QAction *printAct;
  53. QAction *exitAct;
  54. QAction *zoomInAct;
  55. QAction *zoomOutAct;
  56. QAction *normalSizeAct;
  57. QAction *fitToWindowAct;
  58. QAction *aboutAct;
  59. QAction *aboutQtAct;
  60. QMenu *viewMenu;
  61. protected:
  62. void closeEvent(QCloseEvent *event);
  63. };