QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Go to the documentation of this file.
20 #include <QtQuickWidgets/QQuickWidget>
21 #include <QQuickWidget>
22 #include <QQmlContext>
39 return new QQuickWidget( parent );
44 mWidget = qobject_cast<QQuickWidget *>( editor );
50 if ( !mQmlFile.open() )
56 mWidget->setSource( QUrl::fromLocalFile( mQmlFile.fileName() ) );
67 mWidget->engine()->clearComponentCache();
74 if ( !mQmlFile.open() )
81 mQmlFile.write( qmlCode.toUtf8() );
86 void QgsQmlWidgetWrapper::setQmlContext( )
96 QmlExpression *qmlExpression =
new QmlExpression();
97 qmlExpression->setExpressionContext( expressionContext );
99 mWidget->rootContext()->setContextProperty(
"expression", qmlExpression );
115 mExpressionContext = context;
118 QVariant QmlExpression::evaluate(
const QString &expression )
const
121 exp.
prepare( &mExpressionContext );
122 return exp.
evaluate( &mExpressionContext );
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
static QgsExpressionContextScope * formScope(const QgsFeature &formFeature=QgsFeature(), const QString &formMode=QString())
Creates a new scope which contains functions and variables from the current attribute form/table form...
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::MessageLevel::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
bool prepare(const QgsExpressionContext *context)
Gets the expression ready for evaluation - find out column indexes.
QVariant evaluate()
Evaluate the feature and return the result.
Represents a vector layer which manages a vector based data sets.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
QgsExpressionContext createExpressionContext() const FINAL
This method needs to be reimplemented in all classes which implement this interface and return an exp...
Class for parsing and evaluation of expressions (formerly called "search strings")....
This class contains context information for attribute editor widgets. It will be passed to embedded w...
QString attributeFormModeString() const
Returns given attributeFormMode as string.
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.