// Qt includes
#include <QApplication>
#include <QWidgetAction>
+#include <QWheelEvent>
DependencyTree_View::DependencyTree_View( QWidget* theParent )
:GraphicsView_ViewPort( theParent ),
}
}
+//=================================================================================
+// function : wheelEvent()
+// purpose : add zoom action when wheel is spinning
+//=================================================================================
+void DependencyTree_View::wheelEvent( QWheelEvent* event )
+{
+ int inc = 10; // zoom coefficient
+ double cx = width() / 2;
+ double cy = height() / 2;
+ if( event->delta() > 0 )
+ zoom( cx, cy, cx + inc, cy + inc );
+ else
+ zoom( cx, cy, cx - inc, cy - inc );
+
+ QGraphicsView::wheelEvent( event );
+}
+
//=================================================================================
// function : getViewName()
// purpose : return the name of current view
void init( GraphicsView_ViewFrame* );
void updateModel( bool = true, bool = true );
- void mouseMoveEvent(QMouseEvent *event);
+ void mouseMoveEvent(QMouseEvent* event);
+ void wheelEvent( QWheelEvent* event );
QString getViewName() const;
int getStudyId() const;