Class: QgsServerParameterDefinition

class qgis.server.QgsServerParameterDefinition(type: QVariant.Type = QVariant.String, defaultValue: Any = None)

Bases: sip.wrapper

Constructor for QgsServerParameterDefinition.

Parameters
  • type – The type of the parameter

  • defaultValue – The default value of the parameter

QgsServerParameterDefinition(QgsServerParameterDefinition)

Definition of a parameter with basic conversion methods

New in version 3.4:

Methods

isValid

Returns True if the parameter is valid, False otherwise.

loadUrl

Loads the data associated to the parameter converted into an url.

raiseError

Raises an exception in case of an invalid parameters.

toBool

Converts the parameter into a boolean.

toColor

Converts the parameter into a color.

toColorList

Converts the parameter into a list of colors.

toDouble

Converts the parameter into a double.

toDoubleList

Converts the parameter into a list of doubles.

toGeomList

Converts the parameter into a list of geometries.

toInt

Converts the parameter into an integer.

toIntList

Converts the parameter into a list of integers.

toRectangle

Converts the parameter into a rectangle.

toString

Converts the parameter into a string.

toStringList

Converts the parameter into a list of strings

toUrl

Converts the parameter into an url.

typeName

Returns the type of the parameter as a string.

Attributes

isValid(self) bool

Returns True if the parameter is valid, False otherwise.

Return type

bool

loadUrl(self) Tuple[str, bool]

Loads the data associated to the parameter converted into an url.

Parameters

okTrue if there’s no error during the load, False otherwise

Return type

Tuple[str, bool]

Returns

The content loaded

New in version 3.4.

mDefaultValue
mType
mValue
raiseError(msg: str)

Raises an exception in case of an invalid parameters.

Parameters

msg (str) – The message describing the exception

Raises

QgsBadRequestException – Invalid parameter exception

toBool(self) bool

Converts the parameter into a boolean.

Return type

bool

Returns

A boolean

toColor(self) Tuple[QColor, bool]

Converts the parameter into a color.

Parameters

okTrue if there’s no error during the conversion, False otherwise

Return type

Tuple[QColor, bool]

Returns

A color

toColorList(self, delimiter: str = ',') Tuple[List[QColor], bool]

Converts the parameter into a list of colors.

Parameters
  • okTrue if there’s no error during the conversion, False otherwise

  • delimiter (str = ',') – The character used for delimiting

Return type

Tuple[List[QColor], bool]

Returns

A list of colors

toDouble(self) Tuple[float, bool]

Converts the parameter into a double.

Parameters

okTrue if there’s no error during the conversion, False otherwise

Return type

Tuple[float, bool]

Returns

A double

toDoubleList(self, delimiter: str = ',') Tuple[List[float], bool]

Converts the parameter into a list of doubles.

Parameters
  • okTrue if there’s no error during the conversion, False otherwise

  • delimiter (str = ',') – The character used for delimiting

Return type

Tuple[List[float], bool]

Returns

A list of doubles

toGeomList(self, delimiter: str = ',') Tuple[List[QgsGeometry], bool]

Converts the parameter into a list of geometries.

Parameters
  • okTrue if there’s no error during the conversion, False otherwise

  • delimiter (str = ',') – The character used for delimiting

Return type

Tuple[List[QgsGeometry], bool]

Returns

A list of geometries

toInt(self) Tuple[int, bool]

Converts the parameter into an integer.

Parameters

okTrue if there’s no error during the conversion, False otherwise

Return type

Tuple[int, bool]

Returns

An integer

toIntList(self, delimiter: str = ',') Tuple[List[int], bool]

Converts the parameter into a list of integers.

Parameters
  • okTrue if there’s no error during the conversion, False otherwise

  • delimiter (str = ',') – The character used for delimiting

Return type

Tuple[List[int], bool]

Returns

A list of integers

toRectangle(self) Tuple[QgsRectangle, bool]

Converts the parameter into a rectangle.

Parameters

okTrue if there’s no error during the conversion, False otherwise

Return type

Tuple[QgsRectangle, bool]

Returns

A rectangle

toString(self, defaultValue: bool = False) str

Converts the parameter into a string. If defaultValue is true and current value is empty, then the default value is returned.

Parameters

defaultValue (bool = False) –

Return type

str

toStringList(self, delimiter: str = ',', skipEmptyParts: bool = True) List[str]

Converts the parameter into a list of strings

Parameters
  • delimiter (str = ',') – The character used for delimiting

  • skipEmptyParts (bool = True) – To use QString.SkipEmptyParts for splitting

Return type

List[str]

Returns

A list of strings

toUrl(self) Tuple[QUrl, bool]

Converts the parameter into an url.

Parameters

okTrue if there’s no error during the conversion, False otherwise

Return type

Tuple[QUrl, bool]

Returns

An url

New in version 3.4.

typeName(self) str

Returns the type of the parameter as a string.

Return type

str