Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix missing QgsExpressionContext::isReadOnly definition
  • Loading branch information
nyalldawson committed Aug 22, 2015
1 parent d7b7474 commit 8f6669f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/core/qgsexpressioncontext.cpp
Expand Up @@ -281,7 +281,15 @@ QStringList QgsExpressionContext::filteredVariableNames() const
return filtered;
}

bool QgsExpressionContext::isReadOnly( const QString& name ) const { Q_UNUSED( name ); return true; }
bool QgsExpressionContext::isReadOnly( const QString& name ) const
{
Q_FOREACH ( const QgsExpressionContextScope* scope, mStack )
{
if ( scope->isReadOnly( name ) )
return true;
}
return false;
}

bool QgsExpressionContext::hasFunction( const QString &name ) const
{
Expand Down
5 changes: 5 additions & 0 deletions tests/src/core/testqgsexpressioncontext.cpp
Expand Up @@ -281,6 +281,11 @@ void TestQgsExpressionContext::contextStack()
QCOMPARE( scopes.length(), 2 );
QCOMPARE( scopes.at( 0 ), scope1 );
QCOMPARE( scopes.at( 1 ), scope2 );

//check isReadOnly
scope2->addVariable( QgsExpressionContextScope::StaticVariable( "readonly", 5, true ) );
QVERIFY( context.isReadOnly( "readonly" ) );
QVERIFY( !context.isReadOnly( "test" ) );
}

void TestQgsExpressionContext::contextCopy()
Expand Down

0 comments on commit 8f6669f

Please sign in to comment.