20 #include <QtQuickWidgets/QQuickWidget> 21 #include <QQuickWidget> 22 #include <QQmlContext> 38 return new QQuickWidget( parent );
43 mWidget = qobject_cast<QQuickWidget *>( editor );
49 if ( !mQmlFile.open() )
55 mWidget->setSource( QUrl::fromLocalFile( mQmlFile.fileName() ) );
66 mWidget->engine()->clearComponentCache();
73 if ( !mQmlFile.open() )
80 mQmlFile.write( qmlCode.toUtf8() );
85 void QgsQmlWidgetWrapper::setQmlContext( )
95 QmlExpression *qmlExpression =
new QmlExpression();
96 qmlExpression->setExpressionContext( expressionContext );
98 mWidget->rootContext()->setContextProperty(
"expression", qmlExpression );
117 QVariant QmlExpression::evaluate(
const QString &expression )
const 120 exp.
prepare( &mExpressionContext );
121 return exp.
evaluate( &mExpressionContext );
Class for parsing and evaluation of expressions (formerly called "search strings").
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
This class contains context information for attribute editor widgets.
QVariant evaluate()
Evaluate the feature and return the result.
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
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 feat...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
static void logMessage(const QString &message, const QString &tag=QString(), Qgis::MessageLevel level=Qgis::Warning, bool notifyUser=true)
Adds a message to the log instance (and creates it if necessary).
QgsExpressionContext createExpressionContext() const FINAL
This method needs to be reimplemented in all classes which implement this interface and return an exp...
bool prepare(const QgsExpressionContext *context)
Gets the expression ready for evaluation - find out column indexes.
QString attributeFormModeString() const
Returns given attributeFormMode as string.
Represents a vector layer which manages a vector based data sets.