QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
18 #include "qgis_core.h"
27 #include <QStringList>
28 #include <QDomElement>
29 #include <QDomDocument>
34 class QgsPropertyPrivate;
135 QgsPropertyDefinition(
const QString &name,
DataType dataType,
const QString &description,
const QString &helpText,
const QString &origin = QString(),
const QString &comment = QString() );
140 QString
name()
const {
return mName; }
145 void setName(
const QString &name ) { mName = name; }
152 QString
origin()
const {
return mOrigin; }
159 void setOrigin(
const QString &origin ) { mOrigin = origin; }
174 void setComment(
const QString &comment ) { mComment = comment; }
201 bool supportsAssistant()
const;
206 QString mDescription;
207 DataType mTypes = DataTypeString;
209 StandardPropertyTemplate mStandardType = Custom;
213 static QString trString();
254 static QgsProperty fromExpression(
const QString &expression,
bool isActive =
true );
259 static QgsProperty fromField(
const QString &fieldName,
bool isActive =
true );
264 static QgsProperty fromValue(
const QVariant &value,
bool isActive =
true );
274 operator bool()
const;
282 Type propertyType()
const;
288 bool isActive()
const;
294 void setActive(
bool active );
301 void setStaticValue(
const QVariant &value );
308 QVariant staticValue()
const;
315 void setField(
const QString &
field );
322 QString
field()
const;
329 void setExpressionString(
const QString &expression );
336 QString expressionString()
const;
342 QString asExpression()
const;
365 bool isProjectColor()
const;
381 QVariant value(
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant(),
bool *ok
SIP_OUT =
nullptr )
const;
397 QDateTime valueAsDateTime(
const QgsExpressionContext &context,
const QDateTime &defaultDateTime = QDateTime(),
bool *ok
SIP_OUT =
nullptr )
const;
412 QString valueAsString(
const QgsExpressionContext &context,
const QString &defaultString = QString(),
bool *ok
SIP_OUT =
nullptr )
const;
427 QColor valueAsColor(
const QgsExpressionContext &context,
const QColor &defaultColor = QColor(),
bool *ok
SIP_OUT =
nullptr )
const;
480 QVariant toVariant()
const;
488 bool loadVariant(
const QVariant &property );
510 bool convertToTransformer();
513 operator QVariant()
const
515 return QVariant::fromValue( *
this );
520 SIP_PYOBJECT __repr__();
523 QString definitionString;
524 switch ( sipCpp->propertyType() )
527 typeString = QStringLiteral(
"static" );
528 definitionString = sipCpp->staticValue().toString();
532 typeString = QStringLiteral(
"field" );
533 definitionString = sipCpp->field();
537 typeString = QStringLiteral(
"expression" );
538 definitionString = sipCpp->expressionString();
542 typeString = QStringLiteral(
"invalid" );
546 QString str = QStringLiteral(
"<QgsProperty: %1%2%3>" ).arg( !sipCpp->isActive() && sipCpp->propertyType() !=
QgsProperty::InvalidProperty ? QStringLiteral(
"INACTIVE " ) : QString(),
548 definitionString.isEmpty() ? QString() : QStringLiteral(
" (%1)" ).arg( definitionString ) );
549 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
555 mutable QExplicitlySharedDataPointer<QgsPropertyPrivate> d;
561 QVariant propertyValue(
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant(),
bool *ok =
nullptr )
const;
567 #endif // QGSPROPERTY_H
@ RenderUnits
Render units (eg mm/pixels/map units)
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
StandardPropertyTemplate
Predefined standard property templates.
A store for object properties.
@ HorizontalAnchor
Horizontal anchor point.
bool operator==(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
@ FieldBasedProperty
Field based property (QgsFieldBasedProperty)
@ IntegerPositiveGreaterZero
Non-zero positive integer values.
@ DataTypeBoolean
Property requires a boolean value.
@ FillStyle
Fill style (eg solid, lines)
@ DataTypeNumeric
Property requires a numeric value.
@ Double
Double value (including negative values)
@ PenJoinStyle
Pen join style.
@ DateTime
DateTime value.
bool operator!=(const QgsFeatureIterator &fi1, const QgsFeatureIterator &fi2)
@ String
Any string value.
Q_DECLARE_METATYPE(QgsMeshTimeSettings)
@ Rotation
Rotation (value between 0-360 degrees)
DataType dataType() const
Returns the allowable field/value data type for the property.
void setComment(const QString &comment)
Sets comment of the property.
@ ExpressionBasedProperty
Expression based property (QgsExpressionBasedProperty)
DataType
Valid data types required by property.
QString helpText() const
Helper text for using the property, including a description of the valid values for the property.
@ VerticalAnchor
Vertical anchor point.
@ ColorWithAlpha
Color with alpha channel.
@ CapStyle
Line cap style (eg round)
Definition for a property.
StandardPropertyTemplate standardTemplate() const
Returns the property's standard template, if applicable.
QString origin() const
Returns the origin of the property.
@ Double0To1
Double value between 0-1 (inclusive)
QString comment() const
Returns the comment of the property.
@ IntegerPositive
Positive integer values (including 0)
QString description() const
Descriptive name of the property.
void setName(const QString &name)
Sets the name of the property.
@ Size
1D size (eg marker radius, or square marker height/width)
@ LineStyle
Line style (eg solid/dashed)
@ Size2D
2D size (width/height different)
QString name() const
Returns the name of the property.
@ Integer
Integer value (including negative values)
@ SvgPath
Path to an SVG file.
QgsPropertyDefinition()=default
Constructs an empty property.
@ StaticProperty
Static property (QgsStaticProperty)
@ StrokeWidth
Line stroke width.
void setDataType(DataType type)
Sets the data type.
@ ColorNoAlpha
Color with no alpha channel.
@ InvalidProperty
Invalid (not set) property.
void setOrigin(const QString &origin)
Sets the origin of the property.
@ DoublePositive
Positive double value (including 0)