Viadeo Twitter Google Bookmarks ! Facebook Digg del.icio.us MySpace Yahoo MyWeb Blinklist Netvouz Reddit Simpy StumbleUpon Bookmarks Windows Live Favorites 
Logo Documentation Qt ·  Page d'accueil  ·  Toutes les classes  ·  Toutes les fonctions  ·  Vues d'ensemble  · 

QScriptContextInfo Class Reference
[QtScript module]

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

 #include <QScriptContextInfo>

This class is not part of the Qt GUI Framework Edition.

This class was introduced in Qt 4.4.


Public Types

enum FunctionType { ScriptFunction, QtFunction, QtPropertyFunction, NativeFunction }

Public Functions

QScriptContextInfo ( const QScriptContext * context )
QScriptContextInfo ( const QScriptContextInfo & other )
QScriptContextInfo ()
~QScriptContextInfo ()
int columnNumber () const
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

Related Non-Members

QDataStream & operator<< ( QDataStream & stream, const QScriptContextInfo & info )
QDataStream & operator>> ( QDataStream & stream, QScriptContextInfo & info )

Detailed Description

The QScriptContextInfo class provides additional information about a QScriptContext.

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(), lineNumber() and columnNumber().

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().


Member Function Documentation

QScriptContextInfo::QScriptContextInfo ( const QScriptContext * context )

Constructs a new QScriptContextInfo from the given context.

The relevant information is extracted from the context at construction time; i.e. if you continue script execution in the context, the new state of the context will not be reflected in a previously created QScriptContextInfo.

QScriptContextInfo::QScriptContextInfo ( const QScriptContextInfo & other )

Constructs a new QScriptContextInfo from the other info.

QScriptContextInfo::QScriptContextInfo ()

Constructs a null QScriptContextInfo.

See also isNull().

QScriptContextInfo::~QScriptContextInfo ()

Destroys the QScriptContextInfo.

int QScriptContextInfo::columnNumber () const

Returns the column number corresponding to the statement being executed, or -1 if the column number is not available.

The column number is only available if Qt Script code is being executed.

See also lineNumber() and fileName().

QString QScriptContextInfo::fileName () const

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 to QScriptEngine::evaluate().

See also lineNumber() and functionName().

int QScriptContextInfo::functionEndLineNumber () const

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 the functionType() is ScriptFunction.

See also functionStartLineNumber().

int QScriptContextInfo::functionMetaIndex () const

Returns the meta index of the called function, or -1 if the meta index is not available.

The meta index is only available if the functionType() is QtFunction or QtPropertyFunction. For QtFunction, the meta index can be passed to QMetaObject::method() to obtain the corresponding method definition; for QtPropertyFunction, the meta index can be passed to QMetaObject::property() to obtain the corresponding property definition.

See also QScriptContext::thisObject().

QString QScriptContextInfo::functionName () const

Returns the name of the called function, or an empty string if the name is not available.

For script functions of type QtPropertyFunction, this function always returns the name of the property; you can use QScriptContext::argumentCount() to differentiate between reads and writes.

See also fileName() and functionType().

QStringList QScriptContextInfo::functionParameterNames () const

Returns the names of the formal parameters of the called function, or an empty QStringList if the parameter names are not available.

See also QScriptContext::argument().

int QScriptContextInfo::functionStartLineNumber () const

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 the functionType() is ScriptFunction.

See also functionEndLineNumber() and fileName().

FunctionType QScriptContextInfo::functionType () const

Returns the type of the called function.

See also functionName() and QScriptContext::callee().

bool QScriptContextInfo::isNull () const

Returns true if this QScriptContextInfo is null, i.e. does not contain any information.

int QScriptContextInfo::lineNumber () const

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 also columnNumber() and fileName().

qint64 QScriptContextInfo::scriptId () const

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 also QScriptEngineAgent::scriptLoad().

bool QScriptContextInfo::operator!= ( const QScriptContextInfo & other ) const

Returns true if this QScriptContextInfo is not equal to the other info, otherwise returns false.

QScriptContextInfo & QScriptContextInfo::operator= ( const QScriptContextInfo & other )

Assigns the other info to this QScriptContextInfo, and returns a reference to this QScriptContextInfo.

bool QScriptContextInfo::operator== ( const QScriptContextInfo & other ) const

Returns true if this QScriptContextInfo is equal to the other info, otherwise returns false.


Related Non-Members

QDataStream & operator<< ( QDataStream & stream, const QScriptContextInfo & info )

Writes the given info to the specified stream.

This function was introduced in Qt 4.4.

QDataStream & operator>> ( QDataStream & stream, QScriptContextInfo & info )

Reads a QScriptContextInfo from the specified stream into the given info.

This function was introduced in Qt 4.4.

Publicité

Best Of

Actualités les plus lues

Semaine
Mois
Année
  1. « Quelque chose ne va vraiment pas avec les développeurs "modernes" », un développeur à "l'ancienne" critique la multiplication des bibliothèques 53
  2. Les développeurs ignorent-ils trop les failles découvertes dans leur code ? Prenez-vous en compte les remarques des autres ? 17
  3. BlackBerry 10 : premières images du prochain OS de RIM qui devrait intégrer des widgets et des tuiles inspirées de Windows Phone 0
  4. Apercevoir la troisième dimension ou l'utilisation multithreadée d'OpenGL dans Qt, un article des Qt Quarterly traduit par Guillaume Belz 0
  5. Quelles nouveautés de C++11 Visual C++ doit-il rapidement intégrer ? Donnez-nous votre avis 10
  6. Adieu qmake, bienvenue qbs : Qt Building Suite, un outil déclaratif et extensible pour la compilation de projets Qt 17
  7. La rubrique Qt a besoin de vous ! 1
Page suivante

Le blog Digia au hasard

Logo

Déploiement d'applications Qt Commercial sur les tablettes Windows 8

Le blog Digia est l'endroit privilégié pour la communication sur l'édition commerciale de Qt, où des réponses publiques sont apportées aux questions les plus posées au support. Lire l'article.

Communauté

Ressources

Liens utiles

Contact

  • Vous souhaitez rejoindre la rédaction ou proposer un tutoriel, une traduction, une question... ? Postez dans le forum Contribuez ou contactez-nous par MP ou par email (voir en bas de page).

Qt dans le magazine

Cette page est une traduction d'une page de la documentation de Qt, écrite par Nokia Corporation and/or its subsidiary(-ies). Les éventuels problèmes résultant d'une mauvaise traduction ne sont pas imputables à Nokia. Qt 4.6
Copyright © 2012 Developpez LLC. Tous droits réservés Developpez LLC. Aucune reproduction, même partielle, ne peut être faite de ce site et de l'ensemble de son contenu : textes, documents et images sans l'autorisation expresse de Developpez LLC. Sinon, vous encourez selon la loi jusqu'à 3 ans de prison et jusqu'à 300 000 E de dommages et intérêts. Cette page est déposée à la SACD.
Vous avez déniché une erreur ? Un bug ? Une redirection cassée ? Ou tout autre problème, quel qu'il soit ? Ou bien vous désirez participer à ce projet de traduction ? N'hésitez pas à nous contacter ou par MP !
 
 
 
 
Partenaires

Hébergement Web