[Qt-interest] What QT version is this?
Rohan McGovern
rohan.mcgovern at nokia.com
Thu Oct 15 08:54:53 CEST 2009
On Thursday 15 October 2009 08:48:23 ext Scott Sibley wrote:
>
> Evaluator.cpp:26: error: passing 'const QScriptValue' as 'this' argument of
> 'void QScriptValue::setProperty(const QString&, const QScriptValue&, const
> QFlags<QScriptValue::PropertyFlag>&)' discards qualifiers scons: ***
> [Evaluator.o] Error 1
>
> void Evaluator::AddFunction(const char *name,
> QScriptValue (*func)(QScriptContext *ctx, QScriptEngine *eng)) {
> QString key = name;
> obj.setProperty(key, engine.newFunction(func),
> QScriptValue::PropertyGetter); // line 26 }
>
> newFunction returns a const QScriptValue. I'm confused. Why does it except
> a non-const QScriptValue, but not the const?
You're looking at the wrong QScriptValue. The error is: "error: passing
'const QScriptValue' as 'this' argument of ..."
It's telling you: the problem is you're passing a const QScriptValue as the
"this" argument to a QScriptValue member function not marked as const. In
obj.setProperty(...), obj is the "this" argument.
i.e., at line 26, `obj' is const. If it's const then you can't set properties
on it.
More information about the Qt-interest-old
mailing list