diff options
author | Aurindam Jana <aurindam.jana@nokia.com> | 2011-12-14 10:29:52 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2011-12-16 12:36:48 +0100 |
commit | 8eb604656d8cbf8481a540df878ce70936204fb4 (patch) | |
tree | 660af01b6aacb0387aadae018c3ca763c13e6a3d /doc | |
parent | cac6c2d474ae1bf42de3e8138cda71c9e5391437 (diff) |
Console APIs: Update documentation in QDeclarative
Change-Id: Ieb3887f128987c009d39071dd20e68f9e4fe6bc7
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
Reviewed-by: Peter Yard <peter.yard@nokia.com>
Reviewed-by: Jerome Pasion <jerome.pasion@nokia.com>
Diffstat (limited to 'doc')
-rw-r--r-- | doc/src/declarative/qdeclarativedebugging.qdoc | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/doc/src/declarative/qdeclarativedebugging.qdoc b/doc/src/declarative/qdeclarativedebugging.qdoc index ef45c5d717..e2965a1957 100644 --- a/doc/src/declarative/qdeclarativedebugging.qdoc +++ b/doc/src/declarative/qdeclarativedebugging.qdoc @@ -30,20 +30,27 @@ \inqmlmodule QtQuick 2 \title Debugging QML -\section1 Logging +\section1 Console API -\c console.log can be used to print debugging information to the console. For example: +\section2 Log + +\c console.log, console.debug, console.warn and console.error can be used to print +debugging information to the console. For example: \qml -Rectangle { - width: 200; height: 200 - MouseArea { - anchors.fill: parent - onClicked: console.log("clicked") - } +function f(a, b) { + console.log("a is ", a, "b is ", b); } \endqml +The output is generated using the qDebug, qWarning, qCritical methods in C++ +(see also http://doc.qt.nokia.com/latest/debug.html#warning-and-debugging-messages). + +\hint Setting the environment variable QML_CONSOLE_EXTENDED also prints the source +code location of the call. + +\section2 Timer + \c console.time and console.timeEnd log the time (in milliseconds) that was spent between the calls. Both take a string argument that identifies the measurement. For example: @@ -58,6 +65,32 @@ function f() { } \endqml +\section2 Trace + +\c console.trace prints the stack trace of JavaScript execution at the point where +it was called. The stack trace info contains function name, file name, line number +and column number. The stack trace is limited to last 10 stack frames. + +\section2 Profile + +\c console.profile turns on the QML and JavaScript profilers. Nested calls are not +supported and a warning will be printed to the console. + +\c console.profileEnd turns off the QML and JavaScript profilers. Calling this function +without a previous call to console.profile will print a warning to the console. A +profiling client should have been attached before this call to receive and store the +profiling data. For example: + +\qml +function f() { + console.profile(); + //Call some function that needs to be profiled. + //Ensure that a client is attached before ending + //the profiling session. + console.profileEnd(); +} +\endqml + \section1 Debugging Transitions When a transition doesn't look quite right, it can be helpful to view it in slow |