Skip to content
Permalink
Browse files

return if no widget

  • Loading branch information
signedav committed Sep 5, 2018
1 parent d6c0899 commit df8862bc40c0a2f806c51493a22e8f15d97feaed
Showing with 11 additions and 11 deletions.
  1. +11 −11 src/gui/editorwidgets/qgsqmlwidgetwrapper.cpp
@@ -83,20 +83,20 @@ void QgsQmlWidgetWrapper::setQmlCode( const QString &qmlCode )

void QgsQmlWidgetWrapper::setFeature( const QgsFeature &feature )
{
if ( mWidget )
{
QgsExpressionContext context = layer()->createExpressionContext();
context << QgsExpressionContextUtils::globalScope()
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
<< QgsExpressionContextUtils::layerScope( layer() );
if ( !mWidget )
return;

context.setFeature( feature );
QgsExpressionContext context = layer()->createExpressionContext();
context << QgsExpressionContextUtils::globalScope()
<< QgsExpressionContextUtils::projectScope( QgsProject::instance() )
<< QgsExpressionContextUtils::layerScope( layer() );

QmlExpression *qmlExpression = new QmlExpression();
qmlExpression->setExpressionContext( context );
context.setFeature( feature );

mWidget->rootContext()->setContextProperty( "expression", qmlExpression );
}
QmlExpression *qmlExpression = new QmlExpression();
qmlExpression->setExpressionContext( context );

mWidget->rootContext()->setContextProperty( "expression", qmlExpression );
}

void QmlExpression::setExpressionContext( const QgsExpressionContext &context )

0 comments on commit df8862b

Please sign in to comment.
You can’t perform that action at this time.