Skip to content

Commit cb88269

Browse files
committed
Followup 1b2af79, more robust way of setting shortcuts
1 parent 8c14165 commit cb88269

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/app/qgisapp.cpp

+11-8
Original file line numberDiff line numberDiff line change
@@ -936,14 +936,17 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
936936
mMapCanvas->clearExtentHistory(); // reset zoomnext/zoomlast
937937
mLastComposerId = 0;
938938

939-
QAction* zoomAction = new QAction( this );
940-
connect( zoomAction, SIGNAL( triggered( bool ) ), mMapCanvas, SLOT( zoomIn() ) );
941-
zoomAction->setShortcut( QKeySequence( "Ctrl++" ) );
942-
QShortcut* zoomShortCut = new QShortcut( QKeySequence( tr( "Ctrl+=" ) ), this );
943-
connect( zoomShortCut, SIGNAL( activated() ), mMapCanvas, SLOT( zoomIn() ) );
944-
QAction* zoomOutAction = new QAction( this );
945-
connect( zoomOutAction, SIGNAL( triggered( bool ) ), mMapCanvas, SLOT( zoomOut() ) );
946-
zoomOutAction->setShortcut( QKeySequence( "Ctrl+-" ) );
939+
QShortcut* zoomInShortCut = new QShortcut( QKeySequence( tr( "Ctrl++" ) ), this );
940+
connect( zoomInShortCut, SIGNAL( activated() ), mMapCanvas, SLOT( zoomIn() ) );
941+
QShortcut* zoomShortCut2 = new QShortcut( QKeySequence( tr( "Ctrl+=" ) ), this );
942+
connect( zoomShortCut2, SIGNAL( activated() ), mMapCanvas, SLOT( zoomIn() ) );
943+
QShortcut* zoomOutShortCut = new QShortcut( QKeySequence( tr( "Ctrl+-" ) ), this );
944+
connect( zoomOutShortCut, SIGNAL( activated() ), mMapCanvas, SLOT( zoomOut() ) );
945+
946+
//also make ctrl+alt+= a shortcut to switch to zoom in map tool
947+
QShortcut* zoomInToolShortCut = new QShortcut( QKeySequence( tr( "Ctrl+Alt+=" ) ), this );
948+
connect( zoomInToolShortCut, SIGNAL( activated() ), this, SLOT( zoomIn() ) );
949+
947950

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

0 commit comments

Comments
 (0)