Skip to content
Permalink
Browse files

[processing] Fix Import Geotagged photos algorithm incorrectly

assigns form widgets when saving the results to GPKG or other
formats which automatically insert new fields into the result
layer

Also tweak widget behavior for newer resource widget functionality

(cherry picked from commit ff336ad)
  • Loading branch information
nyalldawson committed Nov 20, 2020
1 parent 482d585 commit 4b9d9cf2dcbe05d81fc4dc465b29010dffb6867b
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/analysis/processing/qgsalgorithmimportphotos.cpp
@@ -236,13 +236,17 @@ class SetEditorWidgetForPhotoAttributePostProcessor : public QgsProcessingLayerP
// photo field shows picture viewer
config.insert( QStringLiteral( "DocumentViewer" ), 1 );
config.insert( QStringLiteral( "FileWidget" ), true );
vl->setEditorWidgetSetup( 0, QgsEditorWidgetSetup( QStringLiteral( "ExternalResource" ), config ) );
config.insert( QStringLiteral( "UseLink" ), true );
config.insert( QStringLiteral( "FullUrl" ), true );
vl->setEditorWidgetSetup( vl->fields().lookupField( QStringLiteral( "photo" ) ), QgsEditorWidgetSetup( QStringLiteral( "ExternalResource" ), config ) );

config.clear();
// path field is a directory link
config.insert( QStringLiteral( "FileWidgetButton" ), true );
config.insert( QStringLiteral( "StorageMode" ), 1 );
vl->setEditorWidgetSetup( 2, QgsEditorWidgetSetup( QStringLiteral( "ExternalResource" ), config ) );
config.insert( QStringLiteral( "UseLink" ), true );
config.insert( QStringLiteral( "FullUrl" ), true );
vl->setEditorWidgetSetup( vl->fields().lookupField( QStringLiteral( "directory" ) ), QgsEditorWidgetSetup( QStringLiteral( "ExternalResource" ), config ) );
}
}
};

0 comments on commit 4b9d9cf

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