20#include <QtQuickWidgets/QQuickWidget>
21#include <QQuickWidget>
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() );
86void QgsQmlWidgetWrapper::setQmlContext( )
96 QmlExpression *qmlExpression =
new QmlExpression();
97 qmlExpression->setExpressionContext( expressionContext );
99 mWidget->rootContext()->setContextProperty(
"expression", qmlExpression );
115 mExpressionContext = context;
118QVariant QmlExpression::evaluate(
const QString &expression )
const
121 exp.
prepare( &mExpressionContext );
122 return exp.
evaluate( &mExpressionContext );
This class contains context information for attribute editor widgets.
QString attributeFormModeString() const
Returns given attributeFormMode as string.
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...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
Class for parsing and evaluation of expressions (formerly called "search strings").
bool prepare(const QgsExpressionContext *context)
Gets the expression ready for evaluation - find out column indexes.
QVariant evaluate()
Evaluate the feature and return the result.
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
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).
Represents a vector layer which manages a vector based data sets.
QgsExpressionContext createExpressionContext() const FINAL
This method needs to be reimplemented in all classes which implement this interface and return an exp...