Skip to content

Commit

Permalink
return if no widget
Browse files Browse the repository at this point in the history
  • Loading branch information
signedav committed Sep 5, 2018
1 parent d6c0899 commit df8862b
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/gui/editorwidgets/qgsqmlwidgetwrapper.cpp
Expand Up @@ -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 )
Expand Down

0 comments on commit df8862b

Please sign in to comment.