[Qt-interest] What QT version is this?
Scott Sibley
sisibley at gmail.com
Thu Oct 15 08:48:23 CEST 2009
Oh. Interesting. I think that's what happened. Here's what I called.
QObject *obj = new QObject();
obj->setProperty(name, engine.newFunction(func),
QScriptValue::PropertyGetter);
I can't find it now, but I'm pretty sure I pulled that from the docs.
At any rate, that opened up a new error.
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
}
I'm not sure what to do here. I can pass setProperty a non-const
QScriptValue fine. Here are the signatures:
/usr/include/QtScript/qscriptvalue.h:184: note: candidates are: void
QScriptValue::setProperty(const QString&, const QScriptValue&, const
QFlags<QScriptValue::PropertyFlag>&)
/usr/include/QtScript/qscriptvalue.h:189: note: void
QScriptValue::setProperty(quint32, const QScriptValue&, const
QFlags<QScriptValue::PropertyFlag>&)
/usr/include/QtScript/qscriptvalue.h:194: note: void
QScriptValue::setProperty(const QScriptString&, const QScriptValue&, const
QFlags<QScriptValue::PropertyFlag>&)
newFunction returns a const QScriptValue. I'm confused. Why does it except a
non-const QScriptValue, but not the const?
On Thu, Oct 15, 2009 at 1:04 AM, Rohan McGovern <rohan.mcgovern at nokia.com>wrote:
> On Thursday 15 October 2009 05:40:44 ext Scott Sibley wrote:
> > On my system I have two QT versions -- QT4 and QT3.3. According to the
> QT4
> > docs, there should be a: QObject::setProperty(const char*&,
> QScriptValue,
> > QScriptValue::PropertyFlag)
>
> Where did you see this? AFAICT there's no such function. Maybe you meant
> QScriptValue::setProperty ?
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091015/981e8b84/attachment.html
More information about the Qt-interest-old
mailing list