aboutsummaryrefslogtreecommitdiffstats
path: root/doc/codesnippets/doc/src/snippets/code/src_script_qscriptcontext.cpp
blob: 21e4d13f723913bb03d97e628270f5037eb1971b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
//! [0]
foo(20.5, "hello",  Object())
//! [0]


//! [1]
def Person_prototype_fullName(context, engine):
    self = context.selfObject()
    result = self.property("firstName").toString()
    result += QLatin1String(" ")
    result += self.property("lastName").toString()
    return result
//! [1]


//! [2]
def myInclude(ctx, eng):
    fileName = ctx.argument(0).toString()
    contents = readTheFile(fileName)
    ctx.setActivationObject(ctx.parentContext().activationObject())
    ctx.setThisObject(ctx.parentContext().selfObject())
    return eng.evaluate(contents, fileName)
//! [2]