VPTissue Reference Manual
PanAndZoomView.h
Go to the documentation of this file.
1 #ifndef PAN_AND_ZOOM_VIEW_H_INCLUDED
2 #define PAN_AND_ZOOM_VIEW_H_INCLUDED
3 /*
4  * Copyright 2011-2016 Universiteit Antwerpen
5  *
6  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
7  * the European Commission - subsequent versions of the EUPL (the "Licence");
8  * You may not use this work except in compliance with the Licence.
9  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the Licence is distributed on an "AS IS" basis,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the Licence for the specific language governing
15  * permissions and limitations under the Licence.
16  */
22 #include <QGraphicsView>
23 
24 namespace SimShell {
25 namespace Gui {
26 
31 {
32 public:
33 
41  PanAndZoomView(double zoomMin = 0.07, double zoomMax = 100.0, QWidget *parent = nullptr);
42 
46  virtual ~PanAndZoomView();
47 
52  void ScaleView(double factor);
53 
60  double Scaling();
61 
65  void ResetZoom();
66 
71  virtual void keyPressEvent(QKeyEvent *event);
72 
77  virtual void keyReleaseEvent(QKeyEvent *event);
78 
83  virtual void enterEvent(QEvent *event);
84 
89  virtual void wheelEvent(QWheelEvent *event);
90 
91 private:
92  double m_zoom_min;
93  double m_zoom_max;
94 };
95 
96 } // namespace
97 } // namespace
98 
99 #endif // end_of_inclde_guard
virtual void enterEvent(QEvent *event)
Overriding enterEvent to grab focus when the view is entered.
see the online Qt documentation
QGraphicsView with the ability to pan and zoom.
virtual void keyPressEvent(QKeyEvent *event)
Overriding keyPressEvent to detect when control key is pressed.
double Scaling()
Gets the current scaling of the view (assuming the view was only scaled with ScaleView() and the hori...
PanAndZoomView(double zoomMin=0.07, double zoomMax=100.0, QWidget *parent=nullptr)
Constructor.
virtual void keyReleaseEvent(QKeyEvent *event)
Overriding releasePressEvent to detect when control key is released.
virtual void wheelEvent(QWheelEvent *event)
Overriding wheelEvent to scroll the view when control key is held down.
see the online Qt documentation
void ScaleView(double factor)
Scales the view, bounded by the minimum and maximum zooming factor.
void ResetZoom()
Resets the view to the normal zoom level.
Namespace for generic graphical shell for simulators.
Definition: SimSession.h:32
virtual ~PanAndZoomView()
Destructor.