QGIS API Documentation 3.36.0-Maidenhead (09951dc0acf)
Loading...
Searching...
No Matches
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.
 
 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.
 
 QgsPropertyDefinition (const QString &name, DataType dataType, const QString &description, const QString &helpText, const QString &origin=QString(), const QString &comment=QString())
 Constructor for custom QgsPropertyDefinitions.
 
QString comment () const
 Returns the comment of the property.
 
DataType dataType () const
 Returns the allowable field/value data type for the property.
 
QString description () const
 Descriptive name of the property.
 
QString helpText () const
 Helper text for using the property, including a description of the valid values for the property.
 
QString name () const
 Returns the name of the property.
 
QString origin () const
 Returns the origin of the property.
 
void setComment (const QString &comment)
 Sets comment of the property.
 
void setDataType (DataType type)
 Sets the data type.
 
void setName (const QString &name)
 Sets the name of the property.
 
void setOrigin (const QString &origin)
 Sets the origin of the property.
 
StandardPropertyTemplate standardTemplate () const
 Returns the property's standard template, if applicable.
 
bool supportsAssistant () const
 Returns true if the property is of a type which is compatible with property override assistants.
 

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.

Definition at line 44 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 82 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 49 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 25 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 180 of file qgsproperty.cpp.

Member Function Documentation

◆ comment()

QString QgsPropertyDefinition::comment ( ) const
inline

Returns the comment of the property.

Definition at line 166 of file qgsproperty.h.

◆ dataType()

DataType QgsPropertyDefinition::dataType ( ) const
inline

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

Definition at line 186 of file qgsproperty.h.

◆ description()

QString QgsPropertyDefinition::description ( ) const
inline

Descriptive name of the property.

Definition at line 161 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 176 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 137 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 149 of file qgsproperty.h.

◆ setComment()

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

Sets comment of the property.

Definition at line 171 of file qgsproperty.h.

◆ setDataType()

void QgsPropertyDefinition::setDataType ( DataType  type)
inline

Sets the data type.

Definition at line 181 of file qgsproperty.h.

◆ setName()

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

Sets the name of the property.

Definition at line 142 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 156 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 192 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 189 of file qgsproperty.cpp.


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