Skip to content

Commit

Permalink
[processing] Mark algorithms which use layouts as requiring a project
Browse files Browse the repository at this point in the history
This ensures that the project_path value is correctly set when
exporting the algorithm settings to json or qgis_process commands

Fixes #50483
  • Loading branch information
nyalldawson committed Jan 10, 2023
1 parent 4e6c39b commit e4ab569
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 4 deletions.
Expand Up @@ -68,6 +68,11 @@ void QgsLayoutMapExtentToLayerAlgorithm::initAlgorithm( const QVariantMap & )
addOutput( new QgsProcessingOutputNumber( QStringLiteral( "ROTATION" ), QObject::tr( "Map rotation" ) ) );
}

QgsProcessingAlgorithm::Flags QgsLayoutMapExtentToLayerAlgorithm::flags() const
{
return QgsProcessingAlgorithm::flags() | FlagRequiresProject;
}

QString QgsLayoutMapExtentToLayerAlgorithm::shortHelpString() const
{
return QObject::tr( "This algorithm creates a polygon layer containing the extent of a print layout map item (or items), "
Expand Down
Expand Up @@ -35,6 +35,7 @@ class QgsLayoutMapExtentToLayerAlgorithm : public QgsProcessingAlgorithm

QgsLayoutMapExtentToLayerAlgorithm() = default;
void initAlgorithm( const QVariantMap &configuration = QVariantMap() ) override;
Flags flags() const override;
QString name() const override;
QString displayName() const override;
QStringList tags() const override;
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmlayoutatlastoimage.cpp
Expand Up @@ -114,7 +114,7 @@ void QgsLayoutAtlasToImageAlgorithm::initAlgorithm( const QVariantMap & )

QgsProcessingAlgorithm::Flags QgsLayoutAtlasToImageAlgorithm::flags() const
{
return QgsProcessingAlgorithm::flags() | FlagNoThreading;
return QgsProcessingAlgorithm::flags() | FlagNoThreading | FlagRequiresProject;
}

QgsLayoutAtlasToImageAlgorithm *QgsLayoutAtlasToImageAlgorithm::createInstance() const
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmlayoutatlastopdf.cpp
Expand Up @@ -45,7 +45,7 @@ QString QgsLayoutAtlasToPdfAlgorithmBase::groupId() const

QgsProcessingAlgorithm::Flags QgsLayoutAtlasToPdfAlgorithmBase::flags() const
{
return QgsProcessingAlgorithm::flags() | FlagNoThreading;
return QgsProcessingAlgorithm::flags() | FlagNoThreading | FlagRequiresProject;
}

void QgsLayoutAtlasToPdfAlgorithmBase::initAlgorithm( const QVariantMap & )
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmlayouttoimage.cpp
Expand Up @@ -105,7 +105,7 @@ void QgsLayoutToImageAlgorithm::initAlgorithm( const QVariantMap & )

QgsProcessingAlgorithm::Flags QgsLayoutToImageAlgorithm::flags() const
{
return QgsProcessingAlgorithm::flags() | FlagNoThreading;
return QgsProcessingAlgorithm::flags() | FlagNoThreading | FlagRequiresProject;
}

QgsLayoutToImageAlgorithm *QgsLayoutToImageAlgorithm::createInstance() const
Expand Down
2 changes: 1 addition & 1 deletion src/analysis/processing/qgsalgorithmlayouttopdf.cpp
Expand Up @@ -124,7 +124,7 @@ void QgsLayoutToPdfAlgorithm::initAlgorithm( const QVariantMap & )

QgsProcessingAlgorithm::Flags QgsLayoutToPdfAlgorithm::flags() const
{
return QgsProcessingAlgorithm::flags() | FlagNoThreading;
return QgsProcessingAlgorithm::flags() | FlagNoThreading | FlagRequiresProject;
}

QgsLayoutToPdfAlgorithm *QgsLayoutToPdfAlgorithm::createInstance() const
Expand Down

0 comments on commit e4ab569

Please sign in to comment.