Skip to content

Commit

Permalink
[needs-docs] Use alt modifier to reverse zoom behaviour
Browse files Browse the repository at this point in the history
Previously shift-modifier was used to change zoom in to out, and
zoom out to in. This commit changes it to the more common alt
modifier.
  • Loading branch information
nyalldawson committed Jan 23, 2017
1 parent 7a0fa23 commit ea2ff06
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
16 changes: 8 additions & 8 deletions src/gui/qgscomposerview.cpp
Expand Up @@ -290,7 +290,7 @@ void QgsComposerView::mousePressEvent( QMouseEvent* e )

case Zoom:
{
if ( !( e->modifiers() & Qt::ShiftModifier ) )
if ( !( e->modifiers() & Qt::AltModifier ) )
{
//zoom in action
startMarqueeZoom( scenePoint );
Expand Down Expand Up @@ -1706,7 +1706,7 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )
{
//both control and space pressed
//set cursor to zoom in/out depending on shift key status
QPixmap myZoomQPixmap = QPixmap(( const char ** )(( e->modifiers() & Qt::ShiftModifier ) ? zoom_out : zoom_in ) );
QPixmap myZoomQPixmap = QPixmap(( const char ** )(( e->modifiers() & Qt::AltModifier ) ? zoom_out : zoom_in ) );
QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
viewport()->setCursor( zoomCursor );
}
Expand Down Expand Up @@ -1740,8 +1740,8 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )
mTemporaryZoomStatus = QgsComposerView::Active;
mPreviousTool = mCurrentTool;
setCurrentTool( Zoom );
//set cursor to zoom in/out depending on shift key status
QPixmap myZoomQPixmap = QPixmap(( const char ** )(( e->modifiers() & Qt::ShiftModifier ) ? zoom_out : zoom_in ) );
//set cursor to zoom in/out depending on alt key status
QPixmap myZoomQPixmap = QPixmap(( const char ** )(( e->modifiers() & Qt::AltModifier ) ? zoom_out : zoom_in ) );
QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
viewport()->setCursor( zoomCursor );
return;
Expand All @@ -1750,10 +1750,10 @@ void QgsComposerView::keyPressEvent( QKeyEvent * e )

if ( mCurrentTool == QgsComposerView::Zoom )
{
//using the zoom tool, respond to changes in shift key status and update mouse cursor accordingly
//using the zoom tool, respond to changes in alt key status and update mouse cursor accordingly
if ( ! e->isAutoRepeat() )
{
QPixmap myZoomQPixmap = QPixmap(( const char ** )(( e->modifiers() & Qt::ShiftModifier ) ? zoom_out : zoom_in ) );
QPixmap myZoomQPixmap = QPixmap(( const char ** )(( e->modifiers() & Qt::AltModifier ) ? zoom_out : zoom_in ) );
QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
viewport()->setCursor( zoomCursor );
}
Expand Down Expand Up @@ -1939,10 +1939,10 @@ void QgsComposerView::keyReleaseEvent( QKeyEvent * e )
}
else if ( mCurrentTool == QgsComposerView::Zoom )
{
//if zoom tool is active, respond to changes in the shift key status and update cursor accordingly
//if zoom tool is active, respond to changes in the alt key status and update cursor accordingly
if ( ! e->isAutoRepeat() )
{
QPixmap myZoomQPixmap = QPixmap(( const char ** )(( e->modifiers() & Qt::ShiftModifier ) ? zoom_out : zoom_in ) );
QPixmap myZoomQPixmap = QPixmap(( const char ** )(( e->modifiers() & Qt::AltModifier ) ? zoom_out : zoom_in ) );
QCursor zoomCursor = QCursor( myZoomQPixmap, 7, 7 );
viewport()->setCursor( zoomCursor );
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmaptoolzoom.cpp
Expand Up @@ -84,7 +84,7 @@ void QgsMapToolZoom::canvasReleaseEvent( QgsMapMouseEvent* e )
return;

bool zoomOut = mZoomOut;
if ( e->modifiers() & Qt::ShiftModifier )
if ( e->modifiers() & Qt::AltModifier )
zoomOut = !zoomOut;

// We are not really dragging in this case. This is sometimes caused by
Expand Down

0 comments on commit ea2ff06

Please sign in to comment.