Skip to content

Commit

Permalink
Merge pull request #6399 from nyalldawson/hide_dupe
Browse files Browse the repository at this point in the history
Hide 'duplicate features' actions by default
  • Loading branch information
nyalldawson committed Feb 21, 2018
2 parents 835cca7 + 43350a9 commit f144553
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 17 deletions.
5 changes: 5 additions & 0 deletions resources/qgis_global_settings.ini
Expand Up @@ -33,3 +33,8 @@ connections-xyz\OpenStreetMap\zmin=0
# Default help location to include
# for now this is online version of the User Guide for latest (LTR) release
helpSearchPath=https://docs.qgis.org/$qgis_short_version/$qgis_locale/docs/user_manual/

[app]

# If true, the experimental "duplicate feature" actions will be shown in the QGIS UI
tools\showDuplicateFeatureActions=false
38 changes: 21 additions & 17 deletions src/app/qgisapp.cpp
Expand Up @@ -7489,27 +7489,31 @@ void QgisApp::setupLayoutManagerConnections()

void QgisApp::setupDuplicateFeaturesAction()
{
mDuplicateFeatureAction.reset( new QgsMapLayerAction( tr( "Duplicate feature" ),
nullptr, QgsMapLayerAction::SingleFeature,
QgsApplication::getThemeIcon( QStringLiteral( "/mActionDuplicateFeature.svg" ) ) ) );

QgsGui::mapLayerActionRegistry()->addMapLayerAction( mDuplicateFeatureAction.get() );
connect( mDuplicateFeatureAction.get(), &QgsMapLayerAction::triggeredForFeature, this, [this]( QgsMapLayer * layer, const QgsFeature & feat )
QgsSettings settings;
if ( settings.value( QStringLiteral( "tools/showDuplicateFeatureActions" ), false, QgsSettings::App ).toBool() )
{
duplicateFeatures( layer, feat );
}
);
mDuplicateFeatureAction.reset( new QgsMapLayerAction( tr( "Duplicate feature" ),
nullptr, QgsMapLayerAction::SingleFeature,
QgsApplication::getThemeIcon( QStringLiteral( "/mActionDuplicateFeature.svg" ) ) ) );

mDuplicateFeatureDigitizeAction.reset( new QgsMapLayerAction( tr( "Duplicate feature and digitize" ),
nullptr, QgsMapLayerAction::SingleFeature,
QgsApplication::getThemeIcon( QStringLiteral( "/mActionDuplicateFeatureDigitized.svg" ) ) ) );
QgsGui::mapLayerActionRegistry()->addMapLayerAction( mDuplicateFeatureAction.get() );
connect( mDuplicateFeatureAction.get(), &QgsMapLayerAction::triggeredForFeature, this, [this]( QgsMapLayer * layer, const QgsFeature & feat )
{
duplicateFeatures( layer, feat );
}
);

QgsGui::mapLayerActionRegistry()->addMapLayerAction( mDuplicateFeatureDigitizeAction.get() );
connect( mDuplicateFeatureDigitizeAction.get(), &QgsMapLayerAction::triggeredForFeature, this, [this]( QgsMapLayer * layer, const QgsFeature & feat )
{
duplicateFeatureDigitized( layer, feat );
mDuplicateFeatureDigitizeAction.reset( new QgsMapLayerAction( tr( "Duplicate feature and digitize" ),
nullptr, QgsMapLayerAction::SingleFeature,
QgsApplication::getThemeIcon( QStringLiteral( "/mActionDuplicateFeatureDigitized.svg" ) ) ) );

QgsGui::mapLayerActionRegistry()->addMapLayerAction( mDuplicateFeatureDigitizeAction.get() );
connect( mDuplicateFeatureDigitizeAction.get(), &QgsMapLayerAction::triggeredForFeature, this, [this]( QgsMapLayer * layer, const QgsFeature & feat )
{
duplicateFeatureDigitized( layer, feat );
}
);
}
);
}

void QgisApp::setupAtlasMapLayerAction( QgsPrintLayout *layout, bool enableAction )
Expand Down

0 comments on commit f144553

Please sign in to comment.