summaryrefslogtreecommitdiffstats
path: root/doc/src/snippets/code/src_script_qscriptclass.cpp
blob: 9d55e0f7f07e88192a22ed6421d2cb55fcf70719 (plain)
1
2
3
4
5
6
7
8
9
10
//! [0]
if (extension == Callable) {
    QScriptContext *context = qvariant_cast<QScriptContext*>(argument);
    QScriptEngine *engine = context->engine();
    double sum = 0;
    for (int i = 0; i < context->argumentCount(); ++i)
        sum += context->argument(i).toNumber();
    return sum;
}
//! [0]