Skip to content
Permalink
Browse files

visibility of the new duplicate selected feature default action

  • Loading branch information
signedav authored and m-kuhn committed Oct 31, 2017
1 parent 64f9eb7 commit adc884b0a1b2c18f273538f1e4d83c94c019985d
Showing with 1 addition and 1 deletion.
  1. +1 −1 src/app/qgsattributeactiondialog.cpp
@@ -313,7 +313,7 @@ void QgsAttributeActionDialog::addDefaultActions()
insertRow( pos++, QgsAction::OpenUrl, tr( "Open file" ), QStringLiteral( "[% \"PATH\" %]" ), QLatin1String( "" ), false, tr( "Open file" ), QSet<QString>() << QStringLiteral( "Feature" ) << QStringLiteral( "Canvas" ), QString() );
insertRow( pos++, QgsAction::OpenUrl, tr( "Search on web based on attribute's value" ), QStringLiteral( "http://www.google.com/search?q=[% \"ATTRIBUTE\" %]" ), QLatin1String( "" ), false, tr( "Search Web" ), QSet<QString>() << QStringLiteral( "Field" ), QString() );
insertRow( pos++, QgsAction::GenericPython, tr( "List feature ids" ), QStringLiteral( "from qgis.PyQt import QtWidgets\n\nlayer = QgsProject.instance().mapLayer('[% @layer_id %]')\nif layer.selectedFeatureCount():\n ids = layer.selectedFeatureIds()\nelse:\n ids = [f.id() for f in layer.getFeatures()]\n\nQtWidgets.QMessageBox.information(None, \"Feature ids\", ', '.join([str(id) for id in ids]))" ), QLatin1String( "" ), false, tr( "List feature ids" ), QSet<QString>() << QStringLiteral( "Layer" ), QString() );
insertRow( pos++, QgsAction::GenericPython, tr( "Duplicate selected feature" ), QStringLiteral( "from qgis.PyQt import QtWidgets\n\nproject = QgsProject.instance()\nlayer = QgsProject.instance().mapLayer(\"[% @layer_id %]\")\nlayer.startEditing()\nfeature_count=0\nchildren_info=\"\"\nfor f in layer.selectedFeatures():\n result=QgsVectorLayerUtils.duplicateFeature(layer, f, project, 0 );\n feature_count+=1\n for ch_layer in result[1].layers():\n children_info+=\"{number_of_children} children on layer {children_layer}\\n\".format( number_of_children=str( len( result[1].duplicatedFeatures(ch_layer) ) ), children_layer=ch_layer.name() )\n\nqgis.utils.iface.messageBar().pushMessage( \"{number_of_features} features on layer {layer} duplicated with\\n{children_info}\".format( number_of_features=str( feature_count ), layer=layer.name(), children_info=children_info ) )" ), QLatin1String( "" ), false, tr( "Duplicate" ), QSet<QString>() << QStringLiteral( "Canvas" ) << QStringLiteral( "Layer" ) << QStringLiteral( "Feature" ), QString() );
insertRow( pos++, QgsAction::GenericPython, tr( "Duplicate selected feature" ), QStringLiteral( "from qgis.PyQt import QtWidgets\n\nproject = QgsProject.instance()\nlayer = QgsProject.instance().mapLayer(\"[% @layer_id %]\")\nlayer.startEditing()\nfeature_count=0\nchildren_info=\"\"\nfor f in layer.selectedFeatures():\n result=QgsVectorLayerUtils.duplicateFeature(layer, f, project, 0 );\n feature_count+=1\n for ch_layer in result[1].layers():\n children_info+=\"{number_of_children} children on layer {children_layer}\\n\".format( number_of_children=str( len( result[1].duplicatedFeatures(ch_layer) ) ), children_layer=ch_layer.name() )\n\nqgis.utils.iface.messageBar().pushMessage( \"{number_of_features} features on layer {layer} duplicated with\\n{children_info}\".format( number_of_features=str( feature_count ), layer=layer.name(), children_info=children_info ) )" ), QLatin1String( "" ), false, tr( "Duplicate" ), QSet<QString>() << QStringLiteral( "Canvas" ) << QStringLiteral( "Layer" ), QString() );
}

void QgsAttributeActionDialog::itemDoubleClicked( QTableWidgetItem *item )

0 comments on commit adc884b

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