Class: QgsProcessingParameterFileDestination

A generic file based destination parameter, for specifying the destination path for a file (non-map layer) created by the algorithm.

In some circumstances it is desirable to avoid the usual file overwriting confirmation prompt when users select an existing destination file for this parameter type (e.g., for algorithms which append to an existing destination file instead of overwriting them.). This can be done by setting the widget wrapper metadata “dontconfirmoverwrite” option:

param = QgsProcessingParameterFileDestination( 'OUTPUT', 'Destination file')
# don't show the file overwrite warning when users select a destination file:
param.setMetadata( {'widget_wrapper':
  { 'dontconfirmoverwrite': True }
})

Class Hierarchy

Inheritance diagram of qgis.core.QgsProcessingParameterFileDestination

Base classes

QgsProcessingDestinationParameter

Base class for all parameter definitions which represent file or layer destinations, e.g. parameters which are used for the destination for layers output by an algorithm.

QgsProcessingParameterDefinition

Base class for the definition of processing parameters.

QgsFileFilterGenerator

Abstract interface for classes which generate a file filter string.

Methods

fileFilter

Returns the file filter string for file destinations compatible with this parameter.

setFileFilter

Sets the file filter string for file destinations compatible with this parameter.

Static Methods

fromScriptCode

Creates a new parameter using the definition from a script code.

typeName

Returns the type name for the parameter class.

class qgis.core.QgsProcessingParameterFileDestination[source]

Bases: QgsProcessingDestinationParameter

__init__(name: str | None, description: str | None = '', fileFilter: str | None = '', defaultValue: Any = None, optional: bool = False, createByDefault: bool = True)

Constructor for QgsProcessingParameterFileDestination.

If createByDefault is False and the parameter is optional, then this destination output will not be created by default.

Parameters:
  • name (Optional[str])

  • description (Optional[str] = '')

  • fileFilter (Optional[str] = '')

  • defaultValue (Any = None)

  • optional (bool = False)

  • createByDefault (bool = True)

__init__(a0: QgsProcessingParameterFileDestination)
Parameters:

a0 (QgsProcessingParameterFileDestination)

fileFilter(self) str[source]

Returns the file filter string for file destinations compatible with this parameter.

See also

setFileFilter()

Return type:

str

static fromScriptCode(name: str | None, description: str | None, isOptional: bool, definition: str | None) QgsProcessingParameterFileDestination | None[source]

Creates a new parameter using the definition from a script code.

Parameters:
  • name (Optional[str])

  • description (Optional[str])

  • isOptional (bool)

  • definition (Optional[str])

Return type:

Optional[QgsProcessingParameterFileDestination]

setFileFilter(self, filter: str | None)[source]

Sets the file filter string for file destinations compatible with this parameter.

See also

fileFilter()

Parameters:

filter (Optional[str])

static typeName() str[source]

Returns the type name for the parameter class.

Return type:

str