mirror of
https://git.salome-platform.org/gitpub/modules/geom.git
synced 2024-11-11 16:19:17 +05:00
add zoom action when wheel is spinning
This commit is contained in:
parent
874cf01c2a
commit
fc81102714
@ -36,6 +36,7 @@
|
||||
// Qt includes
|
||||
#include <QApplication>
|
||||
#include <QWidgetAction>
|
||||
#include <QWheelEvent>
|
||||
|
||||
DependencyTree_View::DependencyTree_View( QWidget* 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()
|
||||
// purpose : return the name of current view
|
||||
|
@ -55,6 +55,7 @@ public:
|
||||
void updateModel( bool = true, bool = true );
|
||||
|
||||
void mouseMoveEvent(QMouseEvent* event);
|
||||
void wheelEvent( QWheelEvent* event );
|
||||
|
||||
QString getViewName() const;
|
||||
int getStudyId() const;
|
||||
|
Loading…
Reference in New Issue
Block a user