Hi Sean,

I found this example in the documentation:

QScriptValueList args;
 args << QScriptValue(&engine, 3);
 qDebug() << cube.call(QScriptValue(), args).toNumber(); // 27

So I think you basically do that << for each argument you want to
stick in. Here it looks like they're using QScriptValue() to create a
this object which is deliberately invalid. This is probably the
correct behaviour here because it's a static method (I think?) so
there is no real value for the this pointer.

Maybe it'll help if I explain a little. Hope this isn't patronizing :)
The this pointer is what you get when you make a call to a member
function of an object. When you do:

MyObject bob;
bob.myFunction();

When the compiler does it's magic, you go inside myFunction() and bob
becomes the value of the this pointer. Here, you're just defining
static functions:

void myNonMemberFunction(...) { }

So you aren't acting on any object and the this pointer is undefined.

Adam

2008/12/16 Sean M. Pappalardo <[email protected]>:
> Hi again.
>
> Adam Davison wrote:
>> You'll get a QScriptValue back which will be a function object (in the
>> QtScript sense). Then it has this call thing which takes an argument
>> list as a single QScriptValue. I've never done that bit but if I had
>> to guess I'd say you create a QtScript list object, which you can
>> presumably do either via the engine object or from some QScriptValue
>> constructor. Then you put your arguments as elements in the list and
>> pass it off to that call function.
>
> call looks like this:
> QScriptValue QScriptValue::call ( const QScriptValue & thisObject =
> QScriptValue(), const QScriptValueList & args = QScriptValueList() )
>
> Two questions:
> 1) What do I use for thisObject? (I'm trying to call the script function
> from midiobject.cpp for context.)
> 2) How do I make a QScriptValueList? It's not documented.
>
>> Does that make any sense? :)
>
> Yes, but I need code examples. Trial and error takes a looong time. All
> the ones I've found so far assume a UI.
>
> Sean
>
> <<--------------------------------------------------------------------------------->>
> This E-Mail message has been scanned for viruses
> and cleared by >>SmartMail<< from Smarter Technology, Inc.
> <<--------------------------------------------------------------------------------->>
>

------------------------------------------------------------------------------
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Mixxx-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mixxx-devel

Reply via email to