1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qdeclarativedebugging.qdoc -->
<title>Qt 4.8: Debugging QML</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="content">
<a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
</div>
<div class="breadcrumb toolblock">
<ul>
<li class="first"><a href="index.html">Home</a></li>
<!-- Breadcrumbs go here -->
<li>Debugging QML</li>
</ul>
</div>
</div>
<div class="content mainContent">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#logging">Logging</a></li>
<li class="level1"><a href="#debugging-transitions">Debugging Transitions</a></li>
<li class="level1"><a href="#debugging-module-imports">Debugging module imports</a></li>
<li class="level1"><a href="#debugging-with-qt-creator">Debugging with Qt Creator</a></li>
</ul>
</div>
<h1 class="title">Debugging QML</h1>
<span class="subtitle"></span>
<!-- $$$qdeclarativedebugging.html-description -->
<div class="descr"> <a name="details"></a>
<a name="logging"></a>
<h2>Logging</h2>
<p><tt>console.log</tt> can be used to print debugging information to the console. For example:</p>
<pre class="qml"> <span class="type"><a href="qml-rectangle.html">Rectangle</a></span> {
<span class="name">width</span>: <span class="number">200</span>; <span class="name">height</span>: <span class="number">200</span>
<span class="type"><a href="qml-mousearea.html">MouseArea</a></span> {
<span class="name">anchors</span>.fill: <span class="name">parent</span>
<span class="name">onClicked</span>: <span class="name">console</span>.<span class="name">log</span>(<span class="string">"clicked"</span>)
}
}</pre>
<a name="debugging-transitions"></a>
<h2>Debugging Transitions</h2>
<p>When a transition doesn't look quite right, it can be helpful to view it in slow motion to see what is happening more clearly. This functionality is supported in the <a href="qmlviewer.html">QML Viewer</a> tool: to enable this, click on the "Debugging" menu, then "Slow Down Animations".</p>
<a name="debugging-module-imports"></a>
<h2>Debugging module imports</h2>
<p>The <tt>QML_IMPORT_TRACE</tt> environment variable can be set to enable debug output from QML's import loading mechanisms.</p>
<p>For example, for a simple QML file like this:</p>
<pre class="qml"> import QtQuick 1.0
<span class="type"><a href="qml-rectangle.html">Rectangle</a></span> { <span class="name">width</span>: <span class="number">100</span>; <span class="name">height</span>: <span class="number">100</span> }</pre>
<p>If you set <tt>QML_IMPORT_TRACE=1</tt> before running the <a href="qmlviewer.html">QML Viewer</a> (or your QML C++ application), you will see output similar to this:</p>
<pre class="cpp"> <span class="type">QDeclarativeImportDatabase</span><span class="operator">::</span>addImportPath <span class="string">"/qt-sdk/imports"</span>
<span class="type">QDeclarativeImportDatabase</span><span class="operator">::</span>addImportPath <span class="string">"/qt-sdk/bin/QMLViewer.app/Contents/MacOS"</span>
<span class="type">QDeclarativeImportDatabase</span><span class="operator">::</span>addToImport <span class="number">0x106237370</span> <span class="string">"."</span> <span class="operator">-</span><span class="number">1.</span><span class="operator">-</span><span class="number">1</span> File as <span class="string">""</span>
<span class="type">QDeclarativeImportDatabase</span><span class="operator">::</span>addToImport <span class="number">0x106237370</span> <span class="string">"Qt"</span> <span class="number">4.7</span> Library as <span class="string">""</span>
<span class="type">QDeclarativeImportDatabase</span><span class="operator">::</span>resolveType <span class="string">"Rectangle"</span> <span class="operator">=</span> <span class="string">"QDeclarativeRectangle"</span></pre>
<a name="debugging-with-qt-creator"></a>
<h2>Debugging with Qt Creator</h2>
<p><a href="http://qt.nokia.com/products/developer-tools">Qt Creator</a> provides built-in support for QML debugging. QML projects and standalone C++ applications that utilize QML can be debugged on desktops as well as on remote devices. For more information, see the Qt Creator Manual.</p>
</div>
<!-- @@@qdeclarativedebugging.html -->
<div class="ft">
<span></span>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2012 Nokia Corporation and/or its
subsidiaries. Documentation contributions included herein are the copyrights of
their respective owners.</p>
<br />
<p>
The documentation provided herein is licensed under the terms of the
<a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation
License version 1.3</a> as published by the Free Software Foundation.</p>
<p>
Documentation sources may be obtained from <a href="http://www.qt-project.org">
www.qt-project.org</a>.</p>
<br />
<p>
Nokia, Qt and their respective logos are trademarks of Nokia Corporation
in Finland and/or other countries worldwide. All other trademarks are property
of their respective owners. <a title="Privacy Policy"
href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p>
</div>
</body>
</html>
|