mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2025-01-26 22:40:34 +05:00
add zoom action when wheel is spinning
This commit is contained in:
parent
874cf01c2a
commit
fc81102714
@ -36,6 +36,7 @@
|
|||||||
// Qt includes
|
// Qt includes
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QWidgetAction>
|
#include <QWidgetAction>
|
||||||
|
#include <QWheelEvent>
|
||||||
|
|
||||||
DependencyTree_View::DependencyTree_View( QWidget* theParent )
|
DependencyTree_View::DependencyTree_View( QWidget* theParent )
|
||||||
:GraphicsView_ViewPort( theParent ),
|
:GraphicsView_ViewPort( theParent ),
|
||||||
@ -156,6 +157,23 @@ void DependencyTree_View::mouseMoveEvent( QMouseEvent *event )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//=================================================================================
|
||||||
|
// 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()
|
// function : getViewName()
|
||||||
// purpose : return the name of current view
|
// purpose : return the name of current view
|
||||||
|
@ -54,7 +54,8 @@ public:
|
|||||||
void init( GraphicsView_ViewFrame* );
|
void init( GraphicsView_ViewFrame* );
|
||||||
void updateModel( bool = true, bool = true );
|
void updateModel( bool = true, bool = true );
|
||||||
|
|
||||||
void mouseMoveEvent(QMouseEvent *event);
|
void mouseMoveEvent(QMouseEvent* event);
|
||||||
|
void wheelEvent( QWheelEvent* event );
|
||||||
|
|
||||||
QString getViewName() const;
|
QString getViewName() const;
|
||||||
int getStudyId() const;
|
int getStudyId() const;
|
||||||
|
Loading…
Reference in New Issue
Block a user