132 QgsPropertyDefinition(
const QString &name,
DataType dataType,
const QString &description,
const QString &helpText,
const QString &origin = QString(),
const QString &comment = QString() );
137 QString
name()
const {
return mName; }
142 void setName(
const QString &name ) { mName = name; }
149 QString
origin()
const {
return mOrigin; }
156 void setOrigin(
const QString &origin ) { mOrigin = origin; }
171 void setComment(
const QString &comment ) { mComment = comment; }
198 bool supportsAssistant()
const;
203 QString mDescription;
204 DataType mTypes = DataTypeString;
206 StandardPropertyTemplate mStandardType = Custom;
210 static QString trString();
236 static QVariantMap propertyMapToVariantMap(
const QMap<QString, QgsProperty> &propertyMap );
244 static QMap<QString, QgsProperty> variantMapToPropertyMap(
const QVariantMap &variantMap );
256 static QgsProperty fromExpression(
const QString &expression,
bool isActive =
true );
261 static QgsProperty fromField(
const QString &fieldName,
bool isActive =
true );
266 static QgsProperty fromValue(
const QVariant &value,
bool isActive =
true );
274 explicit operator bool() const
SIP_SKIP;
282 Qgis::PropertyType propertyType() const;
288 bool isActive() const;
310 void setActive(
bool active );
317 void setStaticValue( const QVariant &value );
324 QVariant staticValue() const;
331 void setField( const QString &field );
338 QString field() const;
345 void setExpressionString( const QString &expression );
352 QString expressionString() const;
358 QString asExpression() const;
381 bool isProjectColor() const;
397 QVariant value( const
QgsExpressionContext &context, const QVariant &defaultValue = QVariant(),
bool *ok
SIP_OUT =
nullptr ) const;
413 QDateTime valueAsDateTime( const
QgsExpressionContext &context, const QDateTime &defaultDateTime = QDateTime(),
bool *ok
SIP_OUT =
nullptr ) const;
428 QString valueAsString( const
QgsExpressionContext &context, const QString &defaultString = QString(),
bool *ok
SIP_OUT =
nullptr ) const;
443 QColor valueAsColor( const
QgsExpressionContext &context, const QColor &defaultColor = QColor(),
bool *ok
SIP_OUT =
nullptr ) const;
496 QVariant toVariant() const;
504 bool loadVariant( const QVariant &property );
526 bool convertToTransformer();
529 operator QVariant()
const
531 return QVariant::fromValue( *
this );
536 SIP_PYOBJECT __repr__();
539 QString definitionString;
540 switch ( sipCpp->propertyType() )
543 typeString = QStringLiteral(
"static" );
544 definitionString = sipCpp->staticValue().toString();
548 typeString = QStringLiteral(
"field" );
549 definitionString = sipCpp->field();
553 typeString = QStringLiteral(
"expression" );
554 definitionString = sipCpp->expressionString();
558 typeString = QStringLiteral(
"invalid" );
562 QString str = QStringLiteral(
"<QgsProperty: %1%2%3>" ).arg( !sipCpp->isActive() && sipCpp->propertyType() !=
Qgis::PropertyType::Invalid ? QStringLiteral(
"INACTIVE " ) : QString(),
564 definitionString.isEmpty() ? QString() : QStringLiteral(
" (%1)" ).arg( definitionString ) );
565 sipRes = PyUnicode_FromString( str.toUtf8().constData() );
571 mutable QExplicitlySharedDataPointer<QgsPropertyPrivate> d;
577 QVariant propertyValue(
const QgsExpressionContext &context,
const QVariant &defaultValue = QVariant(),
bool *ok =
nullptr )
const;
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...