QScriptContextInfo Class

The QScriptContextInfo class provides additional information about a QScriptContext. More...

Header: #include <QScriptContextInfo>
qmake: QT += script
Since: Qt 4.4

This class was introduced in Qt 4.4.

Public Types

enum FunctionType { ScriptFunction, QtFunction, QtPropertyFunction, NativeFunction }

Detailed Description

QScriptContextInfo is typically used for debugging purposes. It can provide information about the code being executed, such as the type of the called function, and the original source code location of the current statement.

If the called function is executing Qt Script code, you can obtain the script location with the functions fileName() and lineNumber().

You can obtain the starting line number and ending line number of a Qt Script function definition with functionStartLineNumber() and functionEndLineNumber(), respectively.

For Qt Script functions and Qt methods (e.g. slots), you can call functionParameterNames() to get the names of the formal parameters of the function.

For Qt methods and Qt property accessors, you can obtain the index of the underlying QMetaMethod or QMetaProperty by calling functionMetaIndex().

See also QScriptContext and QScriptEngineAgent.

Member Type Documentation

enum QScriptContextInfo::FunctionType

This enum specifies the type of function being called.

ConstantValueDescription
QScriptContextInfo::ScriptFunction0The function is a Qt Script function, i.e. it was defined through a call to QScriptEngine::evaluate().
QScriptContextInfo::QtFunction1The function is a Qt function (a signal, slot or method).
QScriptContextInfo::QtPropertyFunction2The function is a Qt property getter or setter.
QScriptContextInfo::NativeFunction3The function is a built-in Qt Script function, or it was defined through a call to QScriptEngine::newFunction().