[API] Expose mouse wheel to map tools as QgsMapTool::wheelEvent()

This commit is contained in:
Borys Jurgiel 2013-03-30 20:12:02 +01:00
parent 8299001afe
commit daeafccd49
4 changed files with 19 additions and 0 deletions

View File

@ -47,6 +47,10 @@ class QgsMapTool : QObject
//! Mouse release event for overriding. Default implementation does nothing.
virtual void canvasReleaseEvent( QMouseEvent * e );
//! Mouse wheel event for overriding. Default implementation does nothing.
//! Added in version 2.0
virtual void wheelEvent( QWheelEvent * e );
//! Key event for overriding. Default implementation does nothing.
virtual void keyPressEvent( QKeyEvent* e );

View File

@ -1094,6 +1094,11 @@ void QgsMapCanvas::wheelEvent( QWheelEvent *e )
return;
}
if ( mMapTool )
{
mMapTool->wheelEvent( e );
}
if ( QgsApplication::keyboardModifiers() )
{
// leave the wheel for map tools if any modifier pressed

View File

@ -131,6 +131,11 @@ void QgsMapTool::canvasReleaseEvent( QMouseEvent *e )
Q_UNUSED( e );
}
void QgsMapTool::wheelEvent( QWheelEvent *e )
{
Q_UNUSED( e );
}
void QgsMapTool::keyPressEvent( QKeyEvent *e )
{
Q_UNUSED( e );

View File

@ -30,6 +30,7 @@ class QgsMapLayer;
class QgsMapCanvas;
class QKeyEvent;
class QMouseEvent;
class QWheelEvent;
class QgsPoint;
class QgsRectangle;
class QPoint;
@ -61,6 +62,10 @@ class GUI_EXPORT QgsMapTool : public QObject
//! Mouse release event for overriding. Default implementation does nothing.
virtual void canvasReleaseEvent( QMouseEvent * e );
//! Mouse wheel event for overriding. Default implementation does nothing.
//! Added in version 2.0
virtual void wheelEvent ( QWheelEvent* e );
//! Key event for overriding. Default implementation does nothing.
virtual void keyPressEvent( QKeyEvent* e );