Skip to content

Commit f8f3b21

Browse files
committedJun 7, 2016
Fix cannot set shortcut for zoom in (fix #14958)
1 parent a8cf02a commit f8f3b21

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
10091009
//also make ctrl+alt+= a shortcut to switch to zoom in map tool
10101010
QShortcut* zoomInToolShortCut = new QShortcut( QKeySequence( tr( "Ctrl+Alt+=" ) ), this );
10111011
connect( zoomInToolShortCut, SIGNAL( activated() ), this, SLOT( zoomIn() ) );
1012-
zoomInToolShortCut->setObjectName( "Zoom in" );
1012+
zoomInToolShortCut->setObjectName( "ZoomIn2" );
10131013
zoomInToolShortCut->setWhatsThis( "Zoom in (secondary)" );
10141014

10151015
// Show a nice tip of the day

‎src/gui/qgsshortcutsmanager.cpp

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
***************************************************************************/
1515

1616
#include "qgsshortcutsmanager.h"
17-
17+
#include "qgslogger.h"
1818
#include <QSettings>
1919
#include <QShortcut>
2020

@@ -86,6 +86,12 @@ void QgsShortcutsManager::registerAllChildShortcuts( QObject* object, bool recur
8686

8787
bool QgsShortcutsManager::registerAction( QAction* action, const QString& defaultSequence )
8888
{
89+
#ifdef QGISDEBUG
90+
// if using a debug build, warn on duplicate actions
91+
if ( actionByName( action->text() ) || shortcutByName( action->text() ) )
92+
QgsLogger::warning( QString( "Duplicate shortcut registered: %1" ).arg( action->text() ) );
93+
#endif
94+
8995
mActions.insert( action, defaultSequence );
9096
connect( action, SIGNAL( destroyed() ), this, SLOT( actionDestroyed() ) );
9197

@@ -103,6 +109,12 @@ bool QgsShortcutsManager::registerAction( QAction* action, const QString& defaul
103109

104110
bool QgsShortcutsManager::registerShortcut( QShortcut* shortcut, const QString& defaultSequence )
105111
{
112+
#ifdef QGISDEBUG
113+
// if using a debug build, warn on duplicate actions
114+
if ( actionByName( shortcut->objectName() ) || shortcutByName( shortcut->objectName() ) )
115+
QgsLogger::warning( QString( "Duplicate shortcut registered: %1" ).arg( shortcut->objectName() ) );
116+
#endif
117+
106118
mShortcuts.insert( shortcut, defaultSequence );
107119
connect( shortcut, SIGNAL( destroyed() ), this, SLOT( shortcutDestroyed() ) );
108120

0 commit comments

Comments
 (0)
Please sign in to comment.