24#include <QApplication>
39 event->y() - mLastMousePos.y() );
40 mLastMousePos =
event->pos();
45 if ( event->key() == Qt::Key_Space && !event->isAutoRepeat() )
53 mLastMousePos =
canvas()->mapFromGlobal( QCursor::pos() );
72 event->y() - mLastMousePos.y() );
73 mLastMousePos =
event->pos();
78 if ( event->button() == Qt::MiddleButton )
86 mLastMousePos =
canvas()->mapFromGlobal( QCursor::pos() );
104 if ( !event->isAccepted() )
108 if ( mDeactivateOnMouseRelease )
114 if ( event->isAutoRepeat() )
121 if ( !( event->modifiers() & Qt::ControlModifier ) )
130 mDeactivateOnMouseRelease =
true;
137 updateCursor( event->modifiers() );
138 if ( event->key() == Qt::Key_Space )
140 mDeactivateOnMouseRelease =
false;
147 if ( event->isAutoRepeat() )
153 if ( event->key() == Qt::Key_Space )
163 mDeactivateOnMouseRelease =
true;
168 updateCursor( event->modifiers() );
175 mDeactivateOnMouseRelease =
false;
178 updateCursor( QApplication::keyboardModifiers() );
181void QgsPlotToolTemporaryKeyZoom::updateCursor( Qt::KeyboardModifiers modifiers )
183 canvas()->viewport()->setCursor( ( modifiers & Qt::AltModifier ) ?
static QCursor getThemeCursor(Cursor cursor)
Helper to get a theme cursor.
Plot canvas is a class for displaying interactive 2d charts and plots.
void setTool(QgsPlotTool *tool)
Sets the interactive tool currently being used on the canvas.
virtual void panContentsBy(double dx, double dy)
Pans the plot contents by dx, dy in canvas units.
QgsPlotTool * tool()
Returns the currently active tool.
A QgsPlotMouseEvent is the result of a user interaction with the mouse on a QgsPlotCanvas.