Class: QgsPropertyDefinition

class qgis.core.QgsPropertyDefinition

Bases: sip.wrapper

Constructs an empty property.

QgsPropertyDefinition(name: str, description: str, type: QgsPropertyDefinition.StandardPropertyTemplate, origin: str = ‘’, comment: str = ‘’) Constructor for QgsPropertyDefinition, using a standard property template.

Parameters
  • name – is used internally and should be a unique, alphanumeric string.

  • description – can be any localised string describing what the property is used for.

  • type – one of the predefined standard property template

  • origin – The origin of the property

  • comment – A free comment for the property

QgsPropertyDefinition(name: str, dataType: QgsPropertyDefinition.DataType, description: str, helpText: str, origin: str = ‘’, comment: str = ‘’) Constructor for custom QgsPropertyDefinitions.

Parameters
  • name – is used internally and should be a unique, alphanumeric string.

  • dataType – the data type for the property

  • description – can be any localised string describing what the property is used for.

  • helpText – parameter should specify a descriptive string for users outlining the types of value acceptable by the property (eg ‘dashed’ or ‘solid’ for a line style property).

  • origin – The origin of the property

  • comment – A free comment for the property

QgsPropertyDefinition(QgsPropertyDefinition)

Definition for a property.

QgsPropertyDefinition defines the type of values allowed for a property, and handles descriptive names and help text for using the property. Definitions can use one of the predefined standard templates to simplify definition of commonly used property types, such as colors and blend modes.

Methods

comment

Returns the comment of the property

dataType

Returns the allowable field/value data type for the property.

description

Descriptive name of the property.

helpText

Helper text for using the property, including a description of the valid values for the property.

name

Returns the name of the property.

origin

Returns the origin of the property.

setComment

Sets comment of the property

setDataType

Sets the data type

setName

Sets the name of the property

setOrigin

Sets the origin of the property.

standardTemplate

Returns the property’s standard template, if applicable.

supportsAssistant

Returns True if the property is of a type which is compatible with property override assistants.

Attributes

BlendMode

Boolean

CapStyle

ColorNoAlpha

ColorWithAlpha

Custom

DataTypeBoolean

DataTypeNumeric

DataTypeString

DateTime

Double

Double0To1

DoublePositive

FillStyle

HorizontalAnchor

Integer

IntegerPositive

IntegerPositiveGreaterZero

LineStyle

Offset

Opacity

PenJoinStyle

Point

RenderUnits

Rotation

Size

Size2D

String

StrokeWidth

SvgPath

VerticalAnchor

BlendMode = 14
Boolean = 0
CapStyle = 21
ColorNoAlpha = 12
ColorWithAlpha = 11
Custom = 3000
class DataType

Bases: int

DataTypeBoolean = 2
DataTypeNumeric = 1
DataTypeString = 0
DateTime = 26
Double = 4
Double0To1 = 6
DoublePositive = 5
FillStyle = 20
HorizontalAnchor = 22
Integer = 1
IntegerPositive = 2
IntegerPositiveGreaterZero = 3
LineStyle = 18
Offset = 25
Opacity = 9
PenJoinStyle = 13
Point = 15
RenderUnits = 10
Rotation = 7
Size = 16
Size2D = 17
class StandardPropertyTemplate

Bases: int

String = 8
StrokeWidth = 19
SvgPath = 24
VerticalAnchor = 23
comment(self) → str

Returns the comment of the property

Return type

str

dataType(self)QgsPropertyDefinition.DataType

Returns the allowable field/value data type for the property.

Return type

QgsPropertyDefinition.DataType

description(self) → str

Descriptive name of the property.

Return type

str

helpText(self) → str

Helper text for using the property, including a description of the valid values for the property.

Return type

str

name(self) → str

Returns the name of the property. This is used internally and should be a unique, alphanumeric string.

Return type

str

origin(self) → str

Returns the origin of the property. For example, a PAL property has an origin set to “labeling” while a diagram property has an origin set to “diagram”.

Return type

str

setComment(self, comment: str)

Sets comment of the property

Parameters

comment (str) –

setDataType(self, type: QgsPropertyDefinition.DataType)

Sets the data type

Parameters

type (QgsPropertyDefinition.DataType) –

setName(self, name: str)

Sets the name of the property

Parameters

name (str) –

setOrigin(self, origin: str)

Sets the origin of the property. For example, a PAL property has an origin set to “labeling” while a diagram property has an origin set to “diagram”.

Parameters

origin (str) –

standardTemplate(self)QgsPropertyDefinition.StandardPropertyTemplate

Returns the property’s standard template, if applicable. Non standard types will return the Custom template.

Return type

QgsPropertyDefinition.StandardPropertyTemplate

supportsAssistant(self) → bool

Returns True if the property is of a type which is compatible with property override assistants.

Return type

bool