Engauge Digitizer  2
ViewPreview.h
1 /******************************************************************************************************
2  * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3  * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4  * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5  ******************************************************************************************************/
6 
7 #ifndef VIEW_PREVIEW_H
8 #define VIEW_PREVIEW_H
9 
10 #include <QGraphicsView>
11 #include <QPointF>
12 
14 class ViewPreview : public QGraphicsView
15 {
16  Q_OBJECT;
17 
18 public:
19 
22  VIEW_ASPECT_RATIO_VARIABLE,
23  VIEW_ASPECT_RATIO_ONE_TO_ONE
24  };
25 
27  ViewPreview(QGraphicsScene *scene,
28  ViewAspectRatio viewAspectRatio,
29  QWidget *parent = 0);
30 
32  virtual void mouseMoveEvent(QMouseEvent *event);
33 
35  virtual void resizeEvent(QResizeEvent *event);
36 
38  virtual void wheelEvent (QWheelEvent *event);
39 
40 signals:
42  void signalMouseMove (QPointF pos);
43 
44 private:
45  ViewPreview();
46 
47  ViewAspectRatio m_viewAspectRatio;
48 
49 };
50 
51 #endif // VIEW_PREVIEW_H
void signalMouseMove(QPointF pos)
Forward the mouse move events.
ViewAspectRatio
Prevent aspect ratio distortion in certain previews by providing fixed 1:1 aspect ratio option...
Definition: ViewPreview.h:21
virtual void mouseMoveEvent(QMouseEvent *event)
Intercept cursor move events and forward them.
Definition: ViewPreview.cpp:21
Class that modifies QGraphicsView to automatically expand/shrink the view to fit the window...
Definition: ViewPreview.h:14
virtual void resizeEvent(QResizeEvent *event)
Intercept resize events so we can rescale to the graphics items just fit into the resized window...
Definition: ViewPreview.cpp:34
virtual void wheelEvent(QWheelEvent *event)
Intercept wheel event and discard it so accidentally moving the wheel does not move drawn items out o...
Definition: ViewPreview.cpp:65