Skip to content

Commit

Permalink
variable names, doc and delete dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Jul 3, 2020
1 parent 83ec606 commit dc0039a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
14 changes: 6 additions & 8 deletions src/app/qgisapp.cpp
Expand Up @@ -10217,9 +10217,6 @@ void QgisApp::pasteFromClipboard( QgsMapLayer *destinationLayer )
QgsAttributeEditorContext context( createAttributeEditorContext() );
context.setAllowCustomUi( false );
context.setFormMode( QgsAttributeEditorContext::StandaloneDialog );
context.setVectorLayerTools( mVectorLayerTools );
context.setCadDockWidget( mAdvancedDigitizingDockWidget );
context.setMapCanvas( mMapCanvas );

QgsFixAttributeDialog *dialog = new QgsFixAttributeDialog( pasteVectorLayer, invalidFeatures, this, context );

Expand All @@ -10238,6 +10235,7 @@ void QgisApp::pasteFromClipboard( QgsMapLayer *destinationLayer )
break;
}
pasteFeatures( pasteVectorLayer, invalidGeometriesCount, nTotalFeatures, features );
dialog->deleteLater();
} );
dialog->show();
return;
Expand All @@ -10247,12 +10245,12 @@ void QgisApp::pasteFromClipboard( QgsMapLayer *destinationLayer )
pasteFeatures( pasteVectorLayer, invalidGeometriesCount, nTotalFeatures, newFeatures );
}

void QgisApp::pasteFeatures( QgsVectorLayer *pasteVectorLayer, int invalidGeometriesCount, int nTotalFeatures, QgsFeatureList &newFeatures )
void QgisApp::pasteFeatures( QgsVectorLayer *pasteVectorLayer, int invalidGeometriesCount, int nTotalFeatures, QgsFeatureList &features )
{
pasteVectorLayer->addFeatures( newFeatures );
pasteVectorLayer->addFeatures( features );
QgsFeatureIds newIds;
newIds.reserve( newFeatures.size() );
for ( const QgsFeature &f : qgis::as_const( newFeatures ) )
newIds.reserve( features.size() );
for ( const QgsFeature &f : qgis::as_const( features ) )
{
newIds << f.id();
}
Expand All @@ -10261,7 +10259,7 @@ void QgisApp::pasteFeatures( QgsVectorLayer *pasteVectorLayer, int invalidGeomet
pasteVectorLayer->endEditCommand();
pasteVectorLayer->updateExtents();

int nCopiedFeatures = newFeatures.count();
int nCopiedFeatures = features.count();
Qgis::MessageLevel level = ( nCopiedFeatures == 0 || invalidGeometriesCount > 0 ) ? Qgis::Warning : Qgis::Info;
QString message;
if ( nCopiedFeatures == 0 )
Expand Down
8 changes: 6 additions & 2 deletions src/app/qgisapp.h
Expand Up @@ -928,8 +928,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
*/
void pasteFromClipboard( QgsMapLayer *destinationLayer = nullptr );

void pasteFeatures( QgsVectorLayer *pasteVectorLayer, int invalidGeometriesCount, int nTotalFeatures, QgsFeatureList &newFeatures );

//! copies features on the clipboard to a new vector layer
void pasteAsNewVector();
//! copies features on the clipboard to a new memory vector layer
Expand Down Expand Up @@ -2189,6 +2187,12 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
*/
void resolveVectorLayerWeakRelations( QgsVectorLayer *vectorLayer );

/**
* Pastes the \a features to the \a pasteVectorLayer and gives feedback to the user
* according to \a invalidGeometryCount and \a nTotalFeatures
*/
void pasteFeatures( QgsVectorLayer *pasteVectorLayer, int invalidGeometriesCount, int nTotalFeatures, QgsFeatureList &features );


QgisAppStyleSheet *mStyleSheetBuilder = nullptr;

Expand Down

0 comments on commit dc0039a

Please sign in to comment.