Class: QgsFieldDomain

Base class for field domains.

A field domain is a set of constraints that apply to one or several fields.

Added in version 3.26.

Note

This is an abstract class, with methods which must be implemented by a subclass.

The following methods must be implemented: clone(), type(), typeName()

Class Hierarchy

Inheritance diagram of qgis.core.QgsFieldDomain

Subclasses

QgsCodedFieldDomain

Definition of a coded / enumerated field domain.

QgsGlobFieldDomain

Definition of a field domain for field content validated by a glob.

QgsRangeFieldDomain

Definition of a numeric field domain with a range of validity for values.

Abstract Methods

clone

Clones the field domain.

type

Returns the type of field domain.

typeName

Returns a translated name of the field domain type.

Methods

description

Returns the description of the field domain.

fieldType

Returns the associated field type.

mergePolicy

Returns the merge policy.

name

Returns the name of the field domain.

setDescription

Sets the description of the field domain.

setFieldType

Sets the associated field type.

setMergePolicy

Sets the merge policy.

setName

Sets the name of the field domain.

setSplitPolicy

Sets the split policy.

splitPolicy

Returns the split policy.

class qgis.core.QgsFieldDomain[source]

Bases: object

__init__(name: str | None, description: str | None, fieldType: QMetaType.Type)

Constructor for QgsFieldDomain, with the specified name, description and fieldType.

Parameters:
  • name (Optional[str])

  • description (Optional[str])

  • fieldType (QMetaType.Type)

__init__(name: str | None, description: str | None, fieldType: QVariant.Type)

Constructor for QgsFieldDomain, with the specified name, description and fieldType.

Deprecated since version 3.38: Use the method with a QMetaType.Type argument instead.

Parameters:
  • name (Optional[str])

  • description (Optional[str])

  • fieldType (QVariant.Type)

__init__(a0: QgsFieldDomain)
Parameters:

a0 (QgsFieldDomain)

abstract clone(self) QgsFieldDomain | None[source]

Clones the field domain.

Return type:

Optional[QgsFieldDomain]

description(self) str[source]

Returns the description of the field domain.

See also

setDescription()

Return type:

str

fieldType(self) QMetaType.Type[source]

Returns the associated field type.

See also

setFieldType()

Return type:

QMetaType.Type

mergePolicy(self) Qgis.FieldDomainMergePolicy[source]

Returns the merge policy.

See also

setMergePolicy()

Return type:

Qgis.FieldDomainMergePolicy

name(self) str[source]

Returns the name of the field domain.

See also

setName()

Return type:

str

setDescription(self, description: str | None)[source]

Sets the description of the field domain.

See also

description()

Parameters:

description (Optional[str])

setFieldType(self, type: QMetaType.Type)[source]

Sets the associated field type.

See also

fieldType()

Parameters:

type (QMetaType.Type)

setFieldType(self, type: QVariant.Type)[source]

Sets the associated field type.

See also

fieldType()

Deprecated since version 3.38: Use the method with a QMetaType.Type argument instead.

Parameters:

type (QVariant.Type)

setMergePolicy(self, policy: Qgis.FieldDomainMergePolicy)[source]

Sets the merge policy.

See also

mergePolicy()

Parameters:

policy (Qgis.FieldDomainMergePolicy)

setName(self, name: str | None)[source]

Sets the name of the field domain.

See also

name()

Parameters:

name (Optional[str])

setSplitPolicy(self, policy: Qgis.FieldDomainSplitPolicy)[source]

Sets the split policy.

See also

splitPolicy()

Parameters:

policy (Qgis.FieldDomainSplitPolicy)

splitPolicy(self) Qgis.FieldDomainSplitPolicy[source]

Returns the split policy.

See also

setSplitPolicy()

Return type:

Qgis.FieldDomainSplitPolicy

abstract type(self) Qgis.FieldDomainType[source]

Returns the type of field domain.

Return type:

Qgis.FieldDomainType

abstract typeName(self) str[source]

Returns a translated name of the field domain type.

Return type:

str