MNE-CPP  beta 1.0
tmsiimpedanceview.cpp
1 //=============================================================================================================
38 //*************************************************************************************************************
39 //=============================================================================================================
40 // INCLUDES
41 //=============================================================================================================
42 
43 #include "tmsiimpedanceview.h"
44 
45 
46 //*************************************************************************************************************
47 //=============================================================================================================
48 // USED NAMESPACES
49 //=============================================================================================================
50 
51 using namespace TMSIPlugin;
52 using namespace std;
53 
54 
55 //*************************************************************************************************************
56 //=============================================================================================================
57 // DEFINE MEMBER METHODS
58 //=============================================================================================================
59 
61 : QGraphicsView(parent)
62 {
63  // Enable scene interactions
64  this->setInteractive(true);
65 
66  // Set scene rectangle
67  this->setSceneRect(-25000, -25000, 50000, 50000);
68 
69  // Disable scroll bars - only use drag mode to navigate through scene
70  this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
71  this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
72 
73  // Activate dragging
74  this->setDragMode(QGraphicsView::ScrollHandDrag);
75 
76  // Zoom to mouse cursor position
77  setTransformationAnchor(QGraphicsView::AnchorUnderMouse);
78 }
79 
80 //*************************************************************************************************************
81 
82 void TMSIImpedanceView::wheelEvent(QWheelEvent* event)
83 {
84  if(event->angleDelta().y()>0) // wheel was rotated forward
85  this->scale(1.25,1.25);
86 
87  if(event->angleDelta().y()<0) // wheel was rotated backward
88  this->scale(0.75,0.75);
89 
90  // Don't call superclass handler here as wheel is normally used for moving scrollbars
91  //QGraphicsView::wheelEvent(event);
92 }
93 
94 //*************************************************************************************************************
95 
96 void TMSIImpedanceView::resizeEvent(QResizeEvent* event)
97 {
98  Q_UNUSED(event);
99  this->fitInView(this->scene()->itemsBoundingRect(), Qt::KeepAspectRatio);
100 
101  QGraphicsView::resizeEvent(event);
102 }
103 
104 //*************************************************************************************************************
105 
106 void TMSIImpedanceView::mouseDoubleClickEvent(QMouseEvent* event)
107 {
108  Q_UNUSED(event);
109  this->fitInView(this->scene()->itemsBoundingRect(), Qt::KeepAspectRatio);
110 
111  QGraphicsView::mouseDoubleClickEvent(event);
112 }
Contains the implementation of the TMSIImpedanceView class.
TMSIImpedanceView(QWidget *parent=0)