Skip to content
Permalink
Browse files

Fix missing QgsExpressionContext::isReadOnly definition

  • Loading branch information
nyalldawson committed Aug 22, 2015
1 parent d7b7474 commit 8f6669fcb5a3e6566deedd8fbd3767f2e83a035e
Showing with 14 additions and 1 deletion.
  1. +9 −1 src/core/qgsexpressioncontext.cpp
  2. +5 −0 tests/src/core/testqgsexpressioncontext.cpp
@@ -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
{
@@ -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()

0 comments on commit 8f6669f

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