iRoCS Toolbox  1.1.0
lviewer.hh
Go to the documentation of this file.
1 #ifndef LVIEWER_H
2 #define LVIEWER_H
3 
4 #ifdef HAVE_CONFIG_H
5 #include <config.hh>
6 #endif
7 
8 #include <QtGui/QMainWindow>
9 #include <QtGui/QPrinter>
10 #include <QtCore/QEvent>
11 #include "limagelabel.hh"
12 
13 class QAction;
14 class QLabel;
15 class QMenu;
16 class QScrollArea;
17 class QScrollBar;
18 
19 class lViewer : public QMainWindow
20 {
21  Q_OBJECT
22 
23  public:
24  lViewer(QWidget *parent = NULL);
25  ~lViewer();
26  void show(QImage image);
27 
28  bool eventFilter(QObject * /*obj*/, QEvent *event)
29  {
30  if (event->type() == QEvent::Wheel)
31  {
32  // ignore the event (this effectively
33  // makes it "skip" one object)
34  event->ignore();
35  return true;
36  }
37  // return false to continue event propagation
38  // for all events
39  return false;
40  }
41 
43  QScrollArea *scrollArea;
44 
45  public slots:
46  void open();
47  void print();
48  void zoomIn();
49  void zoomOut();
50  void normalSize();
51  void fitToWindow();
52  void about();
53 
54  signals:
55  void wheel(int delta);
56 
57  private:
58  void createActions();
59  void createMenus();
60  void updateActions();
61  void scaleImage(double factor);
62  void adjustScrollBar(QScrollBar *scrollBar, double factor);
63 
64 
65  double scaleFactor;
66 
67  QPrinter printer;
68 
69  QAction *openAct;
70  QAction *printAct;
71  QAction *exitAct;
72  QAction *zoomInAct;
73  QAction *zoomOutAct;
74  QAction *normalSizeAct;
75  QAction *fitToWindowAct;
76  QAction *aboutAct;
77  QAction *aboutQtAct;
78 
79  QMenu *fileMenu;
80  QMenu *viewMenu;
81  QMenu *helpMenu;
82 };
83 
84 #endif // LVIEWER_H
void about()
bool eventFilter(QObject *, QEvent *event)
Definition: lviewer.hh:28
lImageLabel * imageLabel
Definition: lviewer.hh:42
void open()
lViewer(QWidget *parent=NULL)
void show(QImage image)
void print()
void wheel(int delta)
void normalSize()
QScrollArea * scrollArea
Definition: lviewer.hh:43
void zoomIn()
void zoomOut()
void fitToWindow()