Skip to content
Permalink
Browse files

Followup 1b2af79, more robust way of setting shortcuts

  • Loading branch information
nyalldawson committed Jun 1, 2016
1 parent 8c14165 commit cb882698b4fa265a0085df0818a36519f3420892
Showing with 11 additions and 8 deletions.
  1. +11 −8 src/app/qgisapp.cpp
@@ -936,14 +936,17 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
mMapCanvas->clearExtentHistory(); // reset zoomnext/zoomlast
mLastComposerId = 0;

QAction* zoomAction = new QAction( this );
connect( zoomAction, SIGNAL( triggered( bool ) ), mMapCanvas, SLOT( zoomIn() ) );
zoomAction->setShortcut( QKeySequence( "Ctrl++" ) );
QShortcut* zoomShortCut = new QShortcut( QKeySequence( tr( "Ctrl+=" ) ), this );
connect( zoomShortCut, SIGNAL( activated() ), mMapCanvas, SLOT( zoomIn() ) );
QAction* zoomOutAction = new QAction( this );
connect( zoomOutAction, SIGNAL( triggered( bool ) ), mMapCanvas, SLOT( zoomOut() ) );
zoomOutAction->setShortcut( QKeySequence( "Ctrl+-" ) );
QShortcut* zoomInShortCut = new QShortcut( QKeySequence( tr( "Ctrl++" ) ), this );
connect( zoomInShortCut, SIGNAL( activated() ), mMapCanvas, SLOT( zoomIn() ) );
QShortcut* zoomShortCut2 = new QShortcut( QKeySequence( tr( "Ctrl+=" ) ), this );
connect( zoomShortCut2, SIGNAL( activated() ), mMapCanvas, SLOT( zoomIn() ) );
QShortcut* zoomOutShortCut = new QShortcut( QKeySequence( tr( "Ctrl+-" ) ), this );
connect( zoomOutShortCut, SIGNAL( activated() ), mMapCanvas, SLOT( zoomOut() ) );

//also make ctrl+alt+= a shortcut to switch to zoom in map tool
QShortcut* zoomInToolShortCut = new QShortcut( QKeySequence( tr( "Ctrl+Alt+=" ) ), this );
connect( zoomInToolShortCut, SIGNAL( activated() ), this, SLOT( zoomIn() ) );


// Show a nice tip of the day
if ( settings.value( QString( "/qgis/showTips%1" ).arg( QGis::QGIS_VERSION_INT / 100 ), true ).toBool() )

1 comment on commit cb88269

@nirvn

This comment has been minimized.

Copy link
Contributor

@nirvn nirvn commented on cb88269 Jun 1, 2016

@nyalldawson are these zoom in and out shortcuts customizable? It'd be nice if it was so.

Please sign in to comment.
You can’t perform that action at this time.