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: Enums

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.

Signals

Attributes

qgis.server.QgsServerParameterDefinition.mDefaultValue

qgis.server.QgsServerParameterDefinition.mType

qgis.server.QgsServerParameterDefinition.mValue

isValid(self) → bool

Returns True if the parameter is valid, False otherwise.

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

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 – The message describing the exception throws QgsBadRequestException Invalid parameter exception

toBool(self) → bool

Converts the parameter into a boolean.

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

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 – The character used for delimiting

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

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 – The character used for delimiting

Returns

A list of doubles

toGeomList(self, delimiter: str = ', ') → Tuple[object, bool]

Converts the parameter into a list of geometries.

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

  • delimiter – The character used for delimiting

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

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 – The character used for delimiting

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

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.

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

Converts the parameter into a list of strings

Parameters
  • delimiter – The character used for delimiting

  • skipEmptyParts – To use QString.SkipEmptyParts for splitting

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

Returns

An url

New in version 3.4.

typeName(self) → str

Returns the type of the parameter as a string.