Skip to content
Permalink
Browse files

correctly register shortcuts for snapping toolbar

fix #17037
  • Loading branch information
3nids committed Jan 23, 2018
1 parent dce341e commit 4d1f7ede8a931fb247d4dad233be950d0bda6b48
Showing with 6 additions and 9 deletions.
  1. +3 −7 src/app/qgisapp.cpp
  2. +3 −2 src/app/qgssnappingwidget.cpp
@@ -1206,12 +1206,6 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
zoomInToolShortCut->setWhatsThis( tr( "Zoom in (secondary)" ) );
zoomInToolShortCut->setProperty( "Icon", QgsApplication::getThemeIcon( QStringLiteral( "/mActionZoomIn.svg" ) ) );

QShortcut *toggleSnapping = new QShortcut( QKeySequence( tr( "S", "Keyboard Shortcut: Toggle snapping" ) ), this );
toggleSnapping->setObjectName( QStringLiteral( "toggleSnapping" ) );
toggleSnapping->setWhatsThis( tr( "Toggle snapping" ) );
toggleSnapping->setProperty( "Icon", QgsApplication::getThemeIcon( QStringLiteral( "/mIconSnapping.svg" ) ) );
connect( toggleSnapping, &QShortcut::activated, mSnappingUtils, &QgsSnappingUtils::toggleEnabled );

QShortcut *attributeTableSelected = new QShortcut( QKeySequence( tr( "Shift+F6" ) ), this );
attributeTableSelected->setObjectName( QStringLiteral( "attributeTableSelectedFeatures" ) );
attributeTableSelected->setWhatsThis( tr( "Open Attribute Table (Selected Features)" ) );
@@ -1253,6 +1247,7 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh

// supposedly all actions have been added, now register them to the shortcut manager
QgsGui::shortcutsManager()->registerAllChildren( this );
QgsGui::shortcutsManager()->registerAllChildren( mSnappingWidget );

QgsProviderRegistry::instance()->registerGuis( this );

@@ -2410,7 +2405,8 @@ void QgisApp::createToolBars()
mTracer = new QgsMapCanvasTracer( mMapCanvas, messageBar() );
mTracer->setActionEnableTracing( mSnappingWidget->enableTracingAction() );
mTracer->setActionEnableSnapping( mSnappingWidget->enableSnappingAction() );
connect( mSnappingWidget->tracingOffsetSpinBox(), static_cast< void ( QgsDoubleSpinBox::* )( double ) >( &QgsDoubleSpinBox::valueChanged ),
connect( mSnappingWidget->tracingOffsetSpinBox(),
static_cast< void ( QgsDoubleSpinBox::* )( double ) >( &QgsDoubleSpinBox::valueChanged ),
this, [ = ]( double v ) { mTracer->setOffset( v ); } );

QList<QAction *> toolbarMenuActions;
@@ -89,10 +89,11 @@ QgsSnappingWidget::QgsSnappingWidget( QgsProject *project, QgsMapCanvas *canvas,
mLayerTreeView->resizeColumnToContents( 0 );

// enable button
mEnabledAction = new QAction( this );
mEnabledAction = new QAction( tr( "toggle snapping" ), this );
mEnabledAction->setCheckable( true );
mEnabledAction->setIcon( QIcon( QgsApplication::getThemeIcon( "/mIconSnapping.svg" ) ) );
mEnabledAction->setToolTip( tr( "Enable Snapping" ) );
mEnabledAction->setToolTip( tr( "toggle snapping (S)" ) );
mEnabledAction->setShortcut( tr( "S", "Keyboard shortcut: toggle snapping" ) );
mEnabledAction->setObjectName( QStringLiteral( "EnableSnappingAction" ) );
connect( mEnabledAction, &QAction::toggled, this, &QgsSnappingWidget::enableSnapping );

0 comments on commit 4d1f7ed

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