[Qt-interest] [Qt 4.5] QtScript make a QPoint newable and modifyable.
Benjamin Arnaud
benjamin.arnaud at voxler.fr
Mon May 18 16:04:17 CEST 2009
Hi everyone,
I'm trying to make a QPoint newable and modifyable from QtScript.
I've defined the "QPoint ctor" and "QPoint::setX" function in my script.
The QPoint constructs properly, but I can't seem to find the proper
implementation for setX(int x);
Qt Code:
inline QScriptValue QPoint_setX(QScriptContext *ctx, QScriptEngine *eng)
{
QPoint object = ctx->thisObject().toVariant().toPoint();
if (ctx->argumentCount() == 1 && ctx->argument(0).isNumber())
{
object.setX(ctx->argument(0).toInt32());
// This doesn't seem to apply changes
ctx->setThisObject(eng->newVariant(object));
}
return eng->undefinedValue();
}
Is it possible to do such a thing ?
Benjamin Arnaud.
More information about the Qt-interest-old
mailing list