Skip to content

Commit

Permalink
Disable checkable state for the add feature button for geometryless l…
Browse files Browse the repository at this point in the history
…ayers, it makes it clearer the button can be repeatedly pressed
  • Loading branch information
nirvn authored and github-actions[bot] committed Sep 16, 2024
1 parent bc0d5ff commit 4528f40
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15169,6 +15169,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( layer );
QgsVectorDataProvider *dprovider = vlayer->dataProvider();
QString addFeatureText;
bool addFeatureCheckable = true;

bool isEditable = vlayer->isEditable();
bool layerHasSelection = vlayer->selectedFeatureCount() > 0;
Expand Down Expand Up @@ -15355,6 +15356,7 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
{
mActionAddFeature->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "/mActionNewTableRow.svg" ) ) );
addFeatureText = tr( "Add Record" );
addFeatureCheckable = false;
mActionAddRing->setEnabled( false );
mActionFillRing->setEnabled( false );
mActionReshapeFeatures->setEnabled( false );
Expand All @@ -15368,6 +15370,8 @@ void QgisApp::activateDeactivateLayerRelatedActions( QgsMapLayer *layer )
mActionOpenFieldCalc->setEnabled( true );
mActionAddFeature->setText( addFeatureText );
mActionAddFeature->setToolTip( addFeatureText );
mActionAddFeature->setCheckable( addFeatureCheckable );
mActionAddFeature->setChecked( addFeatureCheckable && mMapCanvas->mapTool() == mMapTools->mapTool( QgsAppMapTools::AddFeature ) );
QgsGui::shortcutsManager()->unregisterAction( mActionAddFeature );
if ( !mActionAddFeature->text().isEmpty() ) // The text will be empty on unknown geometry type -> in this case do not create a shortcut
QgsGui::shortcutsManager()->registerAction( mActionAddFeature, mActionAddFeature->shortcut().toString() );
Expand Down

0 comments on commit 4528f40

Please sign in to comment.