QGIS API Documentation 3.32.0-Lima (311a8cb8a6)
Public Types | Public Member Functions | List of all members
QgsPropertyDefinition Class Reference

Definition for a property. More...

#include <qgsproperty.h>

Public Types

enum  DataType { DataTypeString = 0 , DataTypeNumeric , DataTypeBoolean }
 Valid data types required by property. More...
 
enum  StandardPropertyTemplate {
  Boolean = 0 , Integer , IntegerPositive , IntegerPositiveGreaterZero ,
  Double , DoublePositive , Double0To1 , Rotation ,
  String , Opacity , RenderUnits , ColorWithAlpha ,
  ColorNoAlpha , PenJoinStyle , BlendMode , Point ,
  Size , Size2D , LineStyle , StrokeWidth ,
  FillStyle , CapStyle , HorizontalAnchor , VerticalAnchor ,
  SvgPath , Offset , DateTime , Custom = 3000
}
 Predefined standard property templates. More...
 

Public Member Functions

 QgsPropertyDefinition ()=default
 Constructs an empty property. More...
 
 QgsPropertyDefinition (const QString &name, const QString &description, StandardPropertyTemplate type, const QString &origin=QString(), const QString &comment=QString())
 Constructor for QgsPropertyDefinition, using a standard property template. More...
 
 QgsPropertyDefinition (const QString &name, DataType dataType, const QString &description, const QString &helpText, const QString &origin=QString(), const QString &comment=QString())
 Constructor for custom QgsPropertyDefinitions. More...
 
QString comment () const
 Returns the comment of the property. More...
 
DataType dataType () const
 Returns the allowable field/value data type for the property. More...
 
QString description () const
 Descriptive name of the property. More...
 
QString helpText () const
 Helper text for using the property, including a description of the valid values for the property. More...
 
QString name () const
 Returns the name of the property. More...
 
QString origin () const
 Returns the origin of the property. More...
 
void setComment (const QString &comment)
 Sets comment of the property. More...
 
void setDataType (DataType type)
 Sets the data type. More...
 
void setName (const QString &name)
 Sets the name of the property. More...
 
void setOrigin (const QString &origin)
 Sets the origin of the property. More...
 
StandardPropertyTemplate standardTemplate () const
 Returns the property's standard template, if applicable. More...
 
bool supportsAssistant () const
 Returns true if the property is of a type which is compatible with property override assistants. More...
 

Detailed Description

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.

Since
QGIS 3.0

Definition at line 45 of file qgsproperty.h.

Member Enumeration Documentation

◆ DataType

Valid data types required by property.

Enumerator
DataTypeString 

Property requires a string value.

No numeric values are acceptable by the property. Use this for properties which require a string value such as 'dashed' which cannot be stored in a non-string field.

DataTypeNumeric 

Property requires a numeric value.

Note that setting DataTypeNumeric as the required type means that the property also accepts string fields and inputs, as those may be convertible to a numeric value (Eg "1.0" -> 1.0)

DataTypeBoolean 

Property requires a boolean value.

Note that setting DataTypeBoolean as the required type means that the property also accepts string and numeric fields, as those may be convertible to a boolean value (Eg "1.0" -> true)

Definition at line 83 of file qgsproperty.h.

◆ StandardPropertyTemplate

Predefined standard property templates.

Enumerator
Boolean 

Boolean value.

Integer 

Integer value (including negative values)

IntegerPositive 

Positive integer values (including 0)

IntegerPositiveGreaterZero 

Non-zero positive integer values.

Double 

Double value (including negative values)

DoublePositive 

Positive double value (including 0)

Double0To1 

Double value between 0-1 (inclusive)

Rotation 

Rotation (value between 0-360 degrees)

String 

Any string value.

Opacity 

Opacity (0-100)

RenderUnits 

Render units (eg mm/pixels/map units)

ColorWithAlpha 

Color with alpha channel.

ColorNoAlpha 

Color with no alpha channel.

PenJoinStyle 

Pen join style.

BlendMode 

Blend mode.

Point 

2D point

Size 

1D size (eg marker radius, or square marker height/width)

Size2D 

2D size (width/height different)

LineStyle 

Line style (eg solid/dashed)

StrokeWidth 

Line stroke width.

FillStyle 

Fill style (eg solid, lines)

CapStyle 

Line cap style (eg round)

HorizontalAnchor 

Horizontal anchor point.

VerticalAnchor 

Vertical anchor point.

SvgPath 

Path to an SVG file.

Offset 

2D offset

DateTime 

DateTime value.

Custom 

Custom property types.

Definition at line 50 of file qgsproperty.h.

Constructor & Destructor Documentation

◆ QgsPropertyDefinition() [1/3]

QgsPropertyDefinition::QgsPropertyDefinition ( )
default

Constructs an empty property.

◆ QgsPropertyDefinition() [2/3]

QgsPropertyDefinition::QgsPropertyDefinition ( const QString &  name,
const QString &  description,
QgsPropertyDefinition::StandardPropertyTemplate  type,
const QString &  origin = QString(),
const QString &  comment = QString() 
)

Constructor for QgsPropertyDefinition, using a standard property template.

Parameters
nameis used internally and should be a unique, alphanumeric string.
descriptioncan be any localised string describing what the property is used for.
typeone of the predefined standard property template
originThe origin of the property
commentA free comment for the property

Definition at line 28 of file qgsproperty.cpp.

◆ QgsPropertyDefinition() [3/3]

QgsPropertyDefinition::QgsPropertyDefinition ( const QString &  name,
DataType  dataType,
const QString &  description,
const QString &  helpText,
const QString &  origin = QString(),
const QString &  comment = QString() 
)

Constructor for custom QgsPropertyDefinitions.

Parameters
nameis used internally and should be a unique, alphanumeric string.
dataTypethe data type for the property
descriptioncan be any localised string describing what the property is used for.
helpTextparameter 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).
originThe origin of the property
commentA free comment for the property

Definition at line 183 of file qgsproperty.cpp.

Member Function Documentation

◆ comment()

QString QgsPropertyDefinition::comment ( ) const
inline

Returns the comment of the property.

Definition at line 167 of file qgsproperty.h.

◆ dataType()

DataType QgsPropertyDefinition::dataType ( ) const
inline

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

Definition at line 187 of file qgsproperty.h.

◆ description()

QString QgsPropertyDefinition::description ( ) const
inline

Descriptive name of the property.

Definition at line 162 of file qgsproperty.h.

◆ helpText()

QString QgsPropertyDefinition::helpText ( ) const
inline

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

Definition at line 177 of file qgsproperty.h.

◆ name()

QString QgsPropertyDefinition::name ( ) const
inline

Returns the name of the property.

This is used internally and should be a unique, alphanumeric string.

Definition at line 138 of file qgsproperty.h.

◆ origin()

QString QgsPropertyDefinition::origin ( ) const
inline

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".

Definition at line 150 of file qgsproperty.h.

◆ setComment()

void QgsPropertyDefinition::setComment ( const QString &  comment)
inline

Sets comment of the property.

Definition at line 172 of file qgsproperty.h.

◆ setDataType()

void QgsPropertyDefinition::setDataType ( DataType  type)
inline

Sets the data type.

Definition at line 182 of file qgsproperty.h.

◆ setName()

void QgsPropertyDefinition::setName ( const QString &  name)
inline

Sets the name of the property.

Definition at line 143 of file qgsproperty.h.

◆ setOrigin()

void QgsPropertyDefinition::setOrigin ( const QString &  origin)
inline

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".

Definition at line 157 of file qgsproperty.h.

◆ standardTemplate()

StandardPropertyTemplate QgsPropertyDefinition::standardTemplate ( ) const
inline

Returns the property's standard template, if applicable.

Non standard types will return the Custom template.

Definition at line 193 of file qgsproperty.h.

◆ supportsAssistant()

bool QgsPropertyDefinition::supportsAssistant ( ) const

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

Definition at line 192 of file qgsproperty.cpp.


The documentation for this class was generated from the following files: