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

(cherry picked from commit ff336ad)
  • Loading branch information
nyalldawson committed Nov 20, 2020
1 parent 482d585 commit 4b9d9cf
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/analysis/processing/qgsalgorithmimportphotos.cpp
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 4b9d9cf

Please sign in to comment.