
We bake cookies in your browser for a better experience. Using this site means that you consent.Read More
TheQScriptContextInfo class provides additional information about aQScriptContext.More...
| Header: | #include <QScriptContextInfo> |
| Since: | Qt 4.4 |
| enum | FunctionType { ScriptFunction, QtFunction, QtPropertyFunction, NativeFunction } |
| QScriptContextInfo(const QScriptContext * context) | |
| QScriptContextInfo(const QScriptContextInfo & other) | |
| QScriptContextInfo() | |
| ~QScriptContextInfo() | |
| QString | fileName() const |
| int | functionEndLineNumber() const |
| int | functionMetaIndex() const |
| QString | functionName() const |
| QStringList | functionParameterNames() const |
| int | functionStartLineNumber() const |
| FunctionType | functionType() const |
| bool | isNull() const |
| int | lineNumber() const |
| qint64 | scriptId() const |
| bool | operator!=(const QScriptContextInfo & other) const |
| QScriptContextInfo & | operator=(const QScriptContextInfo & other) |
| bool | operator==(const QScriptContextInfo & other) const |
| QDataStream & | operator<<(QDataStream & stream, const QScriptContextInfo & info) |
| QDataStream & | operator>>(QDataStream & stream, QScriptContextInfo & info) |
TheQScriptContextInfo class provides additional information about aQScriptContext.
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 functionsfileName() andlineNumber().
You can obtain the starting line number and ending line number of a Qt Script function definition withfunctionStartLineNumber() andfunctionEndLineNumber(), respectively.
For Qt Script functions and Qt methods (e.g. slots), you can callfunctionParameterNames() 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 underlyingQMetaMethod orQMetaProperty by callingfunctionMetaIndex().
See alsoQScriptContext andQScriptEngineAgent.
This enum specifies the type of function being called.
| Constant | Value | Description |
|---|---|---|
QScriptContextInfo::ScriptFunction | 0 | The function is a Qt Script function, i.e. it was defined through a call toQScriptEngine::evaluate(). |
QScriptContextInfo::QtFunction | 1 | The function is a Qt function (a signal, slot or method). |
QScriptContextInfo::QtPropertyFunction | 2 | The function is a Qt property getter or setter. |
QScriptContextInfo::NativeFunction | 3 | The function is a built-in Qt Script function, or it was defined through a call toQScriptEngine::newFunction(). |
Constructs a newQScriptContextInfo from the givencontext.
The relevant information is extracted from thecontext at construction time; i.e. if you continue script execution in thecontext, the new state of the context will not be reflected in a previously createdQScriptContextInfo.
Constructs a newQScriptContextInfo from theother info.
Constructs a nullQScriptContextInfo.
See alsoisNull().
Destroys theQScriptContextInfo.
Returns the name of the file where the code being executed was defined, if available; otherwise returns an empty string.
For Qt Script code, this function returns the fileName argument that was passed toQScriptEngine::evaluate().
See alsolineNumber() andfunctionName().
Returns the line number where the definition of the called function ends, or -1 if the line number is not available.
The ending line number is only available if thefunctionType() isScriptFunction.
See alsofunctionStartLineNumber().
Returns the meta index of the called function, or -1 if the meta index is not available.
The meta index is only available if thefunctionType() isQtFunction orQtPropertyFunction. ForQtFunction, the meta index can be passed toQMetaObject::method() to obtain the corresponding method definition; forQtPropertyFunction, the meta index can be passed toQMetaObject::property() to obtain the corresponding property definition.
See alsoQScriptContext::thisObject().
Returns the name of the called function, or an empty string if the name is not available.
For script functions of typeQtPropertyFunction, this function always returns the name of the property; you can useQScriptContext::argumentCount() to differentiate between reads and writes.
See alsofileName() andfunctionType().
Returns the names of the formal parameters of the called function, or an emptyQStringList if the parameter names are not available.
See alsoQScriptContext::argument().
Returns the line number where the definition of the called function starts, or -1 if the line number is not available.
The starting line number is only available if thefunctionType() isScriptFunction.
See alsofunctionEndLineNumber() andfileName().
Returns the type of the called function.
See alsofunctionName() andQScriptContext::callee().
Returns true if thisQScriptContextInfo is null, i.e. does not contain any information.
Returns the line number corresponding to the statement being executed, or -1 if the line number is not available.
The line number is only available if Qt Script code is being executed.
See alsocolumnNumber() andfileName().
Returns the ID of the script where the code being executed was defined, or -1 if the ID is not available (i.e. a native function is being executed).
See alsoQScriptEngineAgent::scriptLoad().
Returns true if thisQScriptContextInfo is not equal to theother info, otherwise returns false.
Assigns theother info to thisQScriptContextInfo, and returns a reference to thisQScriptContextInfo.
Returns true if thisQScriptContextInfo is equal to theother info, otherwise returns false.
Writes the giveninfo to the specifiedstream.
This function was introduced in Qt 4.4.
Reads aQScriptContextInfo from the specifiedstream into the giveninfo.
This function was introduced in Qt 4.4.
© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of theGNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.