Skip to content

Commit

Permalink
[processing] Fix Import Geotagged photos algorithm incorrectly
Browse files Browse the repository at this point in the history
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
  • Loading branch information
nyalldawson committed Oct 18, 2020
1 parent 4cf40fb commit ff336ad
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/analysis/processing/qgsalgorithmimportphotos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 ) );
}
}
};
Expand Down

0 comments on commit ff336ad

Please sign in to comment.