/usr/share/qt5/doc/qtqml/qjsvalue.html is in qtdeclarative5-doc-html 5.5.1-2ubuntu6.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 | <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- qjsvalue.cpp -->
<title>QJSValue Class | Qt QML 5.5</title>
<link rel="stylesheet" type="text/css" href="style/offline.css" />
</head>
<body>
<div class="header" id="qtdocheader">
<div class="main">
<div class="main-rounded">
<div class="navigationbar">
<ul>
<li>Qt 5.5</li>
<li><a href="qtqml-index.html">Qt QML</a></li>
<li><a href="qtqml-module.html">C++ Classes</a></li>
<li>QJSValue</li>
<li id="buildversion">Qt 5.5.1 Reference Documentation</li>
</ul>
</div>
</div>
<div class="content">
<div class="line">
<div class="content mainContent">
<div class="sidebar">
<div class="toc">
<h3><a name="toc">Contents</a></h3>
<ul>
<li class="level1"><a href="#public-types">Public Types</a></li>
<li class="level1"><a href="#public-functions">Public Functions</a></li>
<li class="level1"><a href="#details">Detailed Description</a></li>
</ul>
</div>
<div class="sidebar-content" id="sidebar-content"></div></div>
<h1 class="title">QJSValue Class</h1>
<!-- $$$QJSValue-brief -->
<p>The <a href="qjsvalue.html">QJSValue</a> class acts as a container for Qt/JavaScript data types. <a href="#details">More...</a></p>
<!-- @@@QJSValue -->
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> Header:</td><td class="memItemRight bottomAlign"> <span class="preprocessor">#include <QJSValue></span>
</td></tr><tr><td class="memItemLeft rightAlign topAlign"> qmake:</td><td class="memItemRight bottomAlign"> QT += qml</td></tr><tr><td class="memItemLeft rightAlign topAlign"> Since:</td><td class="memItemRight bottomAlign"> Qt 5.0</td></tr></table></div><ul>
<li><a href="qjsvalue-members.html">List of all members, including inherited members</a></li>
<li><a href="qjsvalue-obsolete.html">Obsolete members</a></li>
</ul>
<a name="public-types"></a>
<h2 id="public-types">Public Types</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#SpecialValue-enum">SpecialValue</a></b> { UndefinedValue, NullValue }</td></tr>
</table></div>
<a name="public-functions"></a>
<h2 id="public-functions">Public Functions</h2>
<div class="table"><table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#QJSValue">QJSValue</a></b>(SpecialValue<i> value</i> = UndefinedValue)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#QJSValue-2">QJSValue</a></b>(const QJSValue &<i> other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#QJSValue-3">QJSValue</a></b>(QJSValue &&<i> other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#QJSValue-4">QJSValue</a></b>(bool<i> value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#QJSValue-5">QJSValue</a></b>(int<i> value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#QJSValue-6">QJSValue</a></b>(uint<i> value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#QJSValue-7">QJSValue</a></b>(double<i> value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#QJSValue-8">QJSValue</a></b>(const QString &<i> value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#QJSValue-9">QJSValue</a></b>(const QLatin1String &<i> value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#QJSValue-10">QJSValue</a></b>(const char *<i> value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#QJSValue-11">QJSValue</a></b>(QV4::ExecutionEngine *<i> e</i>, quint64<i> val</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#dtor.QJSValue">~QJSValue</a></b>()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QJSValue </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#call">call</a></b>(const QJSValueList &<i> args</i> = QJSValueList())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QJSValue </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#callAsConstructor">callAsConstructor</a></b>(const QJSValueList &<i> args</i> = QJSValueList())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QJSValue </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#callWithInstance">callWithInstance</a></b>(const QJSValue &<i> instance</i>, const QJSValueList &<i> args</i> = QJSValueList())</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#deleteProperty">deleteProperty</a></b>(const QString &<i> name</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#equals">equals</a></b>(const QJSValue &<i> other</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#hasOwnProperty">hasOwnProperty</a></b>(const QString &<i> name</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#hasProperty">hasProperty</a></b>(const QString &<i> name</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#isArray">isArray</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#isBool">isBool</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#isCallable">isCallable</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#isDate">isDate</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#isError">isError</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#isNull">isNull</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#isNumber">isNumber</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#isObject">isObject</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#isQObject">isQObject</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#isRegExp">isRegExp</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#isString">isString</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#isUndefined">isUndefined</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#isVariant">isVariant</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QJSValue </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#property">property</a></b>(const QString &<i> name</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QJSValue </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#property-2">property</a></b>(quint32<i> arrayIndex</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QJSValue </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#prototype">prototype</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#setProperty">setProperty</a></b>(const QString &<i> name</i>, const QJSValue &<i> value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#setProperty-2">setProperty</a></b>(quint32<i> arrayIndex</i>, const QJSValue &<i> value</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#setPrototype">setPrototype</a></b>(const QJSValue &<i> prototype</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#strictlyEquals">strictlyEquals</a></b>(const QJSValue &<i> other</i>) const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> bool </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#toBool">toBool</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QDateTime </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#toDateTime">toDateTime</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> qint32 </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#toInt">toInt</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> double </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#toNumber">toNumber</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QObject * </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#toQObject">toQObject</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QString </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#toString">toString</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> quint32 </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#toUInt">toUInt</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QVariant </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#toVariant">toVariant</a></b>() const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QJSValue & </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#operator-eq">operator=</a></b>(QJSValue &&<i> other</i>)</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QJSValue & </td><td class="memItemRight bottomAlign"><b><a href="qjsvalue.html#operator-eq-2">operator=</a></b>(const QJSValue &<i> other</i>)</td></tr>
</table></div>
<a name="details"></a>
<!-- $$$QJSValue-description -->
<div class="descr">
<h2 id="details">Detailed Description</h2>
<p>The <a href="qjsvalue.html">QJSValue</a> class acts as a container for Qt/JavaScript data types.</p>
<p><a href="qjsvalue.html">QJSValue</a> supports the types defined in the <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMA-262</a> standard: The primitive types, which are Undefined, Null, Boolean, Number, and String; and the Object type. Additionally, built-in support is provided for Qt/C++ types such as QVariant and QObject.</p>
<p>For the object-based types (including Date and RegExp), use the newT() functions in <a href="qjsengine.html">QJSEngine</a> (e.g. <a href="qjsengine.html#newObject">QJSEngine::newObject</a>()) to create a <a href="qjsvalue.html">QJSValue</a> of the desired type. For the primitive types, use one of the <a href="qjsvalue.html">QJSValue</a> constructor overloads.</p>
<p>The methods named isT() (e.g. <a href="qjsvalue.html#isBool">isBool</a>(), <a href="qjsvalue.html#isUndefined">isUndefined</a>()) can be used to test if a value is of a certain type. The methods named toT() (e.g. <a href="qjsvalue.html#toBool">toBool</a>(), <a href="qjsvalue.html#toString">toString</a>()) can be used to convert a <a href="qjsvalue.html">QJSValue</a> to another type. You can also use the generic QJSValue_cast() function.</p>
<p>Object values have zero or more properties which are themselves QJSValues. Use <a href="qjsvalue.html#setProperty">setProperty</a>() to set a property of an object, and call <a href="qjsvalue.html#property">property</a>() to retrieve the value of a property.</p>
<pre class="cpp"><span class="type"><a href="qjsengine.html">QJSEngine</a></span> myEngine;
<span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> myObject <span class="operator">=</span> myEngine<span class="operator">.</span>newObject();
<span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> myOtherObject <span class="operator">=</span> myEngine<span class="operator">.</span>newObject();
myObject<span class="operator">.</span><a href="qjsvalue.html#setProperty">setProperty</a>(<span class="string">"myChild"</span><span class="operator">,</span> myOtherObject);
myObject<span class="operator">.</span><a href="qjsvalue.html#setProperty">setProperty</a>(<span class="string">"name"</span><span class="operator">,</span> <span class="string">"John Doe"</span>);</pre>
<p>If you want to iterate over the properties of a script object, use the <a href="qjsvalueiterator.html">QJSValueIterator</a> class.</p>
<p>Object values have an internal <code>prototype</code> property, which can be accessed with <a href="qjsvalue.html#prototype">prototype</a>() and <a href="qjsvalue.html#setPrototype">setPrototype</a>().</p>
<p>Function objects (objects for which <a href="qjsvalue.html#isCallable">isCallable</a>()) returns true) can be invoked by calling <a href="qjsvalue.html#call">call</a>(). Constructor functions can be used to construct new objects by calling <a href="qjsvalue.html#callAsConstructor">callAsConstructor</a>().</p>
<p>Use <a href="qjsvalue.html#equals">equals</a>() or <a href="qjsvalue.html#strictlyEquals">strictlyEquals</a>() to compare a <a href="qjsvalue.html">QJSValue</a> to another.</p>
<p>Note that a <a href="qjsvalue.html">QJSValue</a> for which <a href="qjsvalue.html#isObject">isObject</a>() is true only carries a reference to an actual object; copying the <a href="qjsvalue.html">QJSValue</a> will only copy the object reference, not the object itself. If you want to clone an object (i.e. copy an object's properties to another object), you can do so with the help of a <code>for-in</code> statement in script code, or <a href="qjsvalueiterator.html">QJSValueIterator</a> in C++.</p>
</div>
<p><b>See also </b><a href="qjsengine.html">QJSEngine</a> and <a href="qjsvalueiterator.html">QJSValueIterator</a>.</p>
<!-- @@@QJSValue -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$SpecialValue$$$NullValue$$$UndefinedValue -->
<h3 class="fn" id="SpecialValue-enum"><a name="SpecialValue-enum"></a>enum QJSValue::<span class="name">SpecialValue</span></h3>
<p>This enum is used to specify a single-valued type.</p>
<div class="table"><table class="valuelist"><tr valign="top" class="odd"><th class="tblConst">Constant</th><th class="tblval">Value</th><th class="tbldscr">Description</th></tr>
<tr><td class="topAlign"><code>QJSValue::UndefinedValue</code></td><td class="topAlign"><code>1</code></td><td class="topAlign">An undefined value.</td></tr>
<tr><td class="topAlign"><code>QJSValue::NullValue</code></td><td class="topAlign"><code>0</code></td><td class="topAlign">A null value.</td></tr>
</table></div>
<!-- @@@SpecialValue -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QJSValue[overload1]$$$QJSValueSpecialValue -->
<h3 class="fn" id="QJSValue"><a name="QJSValue"></a>QJSValue::<span class="name">QJSValue</span>(<span class="type"><a href="qjsvalue.html#SpecialValue-enum">SpecialValue</a></span><i> value</i> = UndefinedValue)</h3>
<p>Constructs a new <a href="qjsvalue.html">QJSValue</a> with a special <i>value</i>.</p>
<!-- @@@QJSValue -->
<!-- $$$QJSValue$$$QJSValueconstQJSValue& -->
<h3 class="fn" id="QJSValue-2"><a name="QJSValue-2"></a>QJSValue::<span class="name">QJSValue</span>(const <span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> &<i> other</i>)</h3>
<p>Constructs a new <a href="qjsvalue.html">QJSValue</a> that is a copy of <i>other</i>.</p>
<p>Note that if <i>other</i> is an object (i.e., <a href="qjsvalue.html#isObject">isObject</a>() would return true), then only a reference to the underlying object is copied into the new script value (i.e., the object itself is not copied).</p>
<!-- @@@QJSValue -->
<!-- $$$QJSValue$$$QJSValueQJSValue&& -->
<h3 class="fn" id="QJSValue-3"><a name="QJSValue-3"></a>QJSValue::<span class="name">QJSValue</span>(<span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> &&<i> other</i>)</h3>
<p>Move constructor. Moves from <i>other</i> into this <a href="qjsvalue.html">QJSValue</a> object.</p>
<!-- @@@QJSValue -->
<!-- $$$QJSValue$$$QJSValuebool -->
<h3 class="fn" id="QJSValue-4"><a name="QJSValue-4"></a>QJSValue::<span class="name">QJSValue</span>(<span class="type">bool</span><i> value</i>)</h3>
<p>Constructs a new <a href="qjsvalue.html">QJSValue</a> with a boolean <i>value</i>.</p>
<!-- @@@QJSValue -->
<!-- $$$QJSValue$$$QJSValueint -->
<h3 class="fn" id="QJSValue-5"><a name="QJSValue-5"></a>QJSValue::<span class="name">QJSValue</span>(<span class="type">int</span><i> value</i>)</h3>
<p>Constructs a new <a href="qjsvalue.html">QJSValue</a> with a number <i>value</i>.</p>
<!-- @@@QJSValue -->
<!-- $$$QJSValue$$$QJSValueuint -->
<h3 class="fn" id="QJSValue-6"><a name="QJSValue-6"></a>QJSValue::<span class="name">QJSValue</span>(<span class="type">uint</span><i> value</i>)</h3>
<p>Constructs a new <a href="qjsvalue.html">QJSValue</a> with a number <i>value</i>.</p>
<!-- @@@QJSValue -->
<!-- $$$QJSValue$$$QJSValuedouble -->
<h3 class="fn" id="QJSValue-7"><a name="QJSValue-7"></a>QJSValue::<span class="name">QJSValue</span>(<span class="type">double</span><i> value</i>)</h3>
<p>Constructs a new <a href="qjsvalue.html">QJSValue</a> with a number <i>value</i>.</p>
<!-- @@@QJSValue -->
<!-- $$$QJSValue$$$QJSValueconstQString& -->
<h3 class="fn" id="QJSValue-8"><a name="QJSValue-8"></a>QJSValue::<span class="name">QJSValue</span>(const <span class="type">QString</span> &<i> value</i>)</h3>
<p>Constructs a new <a href="qjsvalue.html">QJSValue</a> with a string <i>value</i>.</p>
<!-- @@@QJSValue -->
<!-- $$$QJSValue$$$QJSValueconstQLatin1String& -->
<h3 class="fn" id="QJSValue-9"><a name="QJSValue-9"></a>QJSValue::<span class="name">QJSValue</span>(const <span class="type">QLatin1String</span> &<i> value</i>)</h3>
<p>Constructs a new <a href="qjsvalue.html">QJSValue</a> with a string <i>value</i>.</p>
<!-- @@@QJSValue -->
<!-- $$$QJSValue$$$QJSValueconstchar* -->
<h3 class="fn" id="QJSValue-10"><a name="QJSValue-10"></a>QJSValue::<span class="name">QJSValue</span>(const <span class="type">char</span> *<i> value</i>)</h3>
<p>Constructs a new <a href="qjsvalue.html">QJSValue</a> with a string <i>value</i>.</p>
<!-- @@@QJSValue -->
<!-- $$$QJSValue$$$QJSValueQV4::ExecutionEngine*quint64 -->
<h3 class="fn" id="QJSValue-11"><a name="QJSValue-11"></a>QJSValue::<span class="name">QJSValue</span>(<span class="type"><a href="qv4-executionengine.html">QV4::ExecutionEngine</a></span> *<i> e</i>, <span class="type">quint64</span><i> val</i>)</h3>
<!-- @@@QJSValue -->
<!-- $$$~QJSValue[overload1]$$$~QJSValue -->
<h3 class="fn" id="dtor.QJSValue"><a name="dtor.QJSValue"></a>QJSValue::<span class="name">~QJSValue</span>()</h3>
<p>Destroys this <a href="qjsvalue.html">QJSValue</a>.</p>
<!-- @@@~QJSValue -->
<!-- $$$call[overload1]$$$callconstQJSValueList& -->
<h3 class="fn" id="call"><a name="call"></a><span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> QJSValue::<span class="name">call</span>(const <span class="type">QJSValueList</span> &<i> args</i> = QJSValueList())</h3>
<p>Calls this <a href="qjsvalue.html">QJSValue</a> as a function, passing <i>args</i> as arguments to the function, and using the globalObject() as the "this"-object. Returns the value returned from the function.</p>
<p>If this <a href="qjsvalue.html">QJSValue</a> is not callable, call() does nothing and returns an undefined <a href="qjsvalue.html">QJSValue</a>.</p>
<p>Calling call() can cause an exception to occur in the script engine; in that case, call() returns the value that was thrown (typically an <code>Error</code> object). You can call <a href="qjsvalue.html#isError">isError</a>() on the return value to determine whether an exception occurred.</p>
<p><b>See also </b><a href="qjsvalue.html#isCallable">isCallable</a>(), <a href="qjsvalue.html#callWithInstance">callWithInstance</a>(), and <a href="qjsvalue.html#callAsConstructor">callAsConstructor</a>().</p>
<!-- @@@call -->
<!-- $$$callAsConstructor[overload1]$$$callAsConstructorconstQJSValueList& -->
<h3 class="fn" id="callAsConstructor"><a name="callAsConstructor"></a><span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> QJSValue::<span class="name">callAsConstructor</span>(const <span class="type">QJSValueList</span> &<i> args</i> = QJSValueList())</h3>
<p>Creates a new <code>Object</code> and calls this <a href="qjsvalue.html">QJSValue</a> as a constructor, using the created object as the `this' object and passing <i>args</i> as arguments. If the return value from the constructor call is an object, then that object is returned; otherwise the default constructed object is returned.</p>
<p>If this <a href="qjsvalue.html">QJSValue</a> is not a function, callAsConstructor() does nothing and returns an undefined <a href="qjsvalue.html">QJSValue</a>.</p>
<p>Calling this function can cause an exception to occur in the script engine; in that case, the value that was thrown (typically an <code>Error</code> object) is returned. You can call <a href="qjsvalue.html#isError">isError</a>() on the return value to determine whether an exception occurred.</p>
<p><b>See also </b><a href="qjsvalue.html#call">call</a>() and <a href="qjsengine.html#newObject">QJSEngine::newObject</a>().</p>
<!-- @@@callAsConstructor -->
<!-- $$$callWithInstance[overload1]$$$callWithInstanceconstQJSValue&constQJSValueList& -->
<h3 class="fn" id="callWithInstance"><a name="callWithInstance"></a><span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> QJSValue::<span class="name">callWithInstance</span>(const <span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> &<i> instance</i>, const <span class="type">QJSValueList</span> &<i> args</i> = QJSValueList())</h3>
<p>Calls this <a href="qjsvalue.html">QJSValue</a> as a function, using <i>instance</i> as the `this' object in the function call, and passing <i>args</i> as arguments to the function. Returns the value returned from the function.</p>
<p>If this <a href="qjsvalue.html">QJSValue</a> is not a function, <a href="qjsvalue.html#call">call</a>() does nothing and returns an undefined <a href="qjsvalue.html">QJSValue</a>.</p>
<p>Note that if <i>instance</i> is not an object, the global object (see <a href="qjsengine.html#globalObject">QJSEngine::globalObject</a>()) will be used as the `this' object.</p>
<p>Calling <a href="qjsvalue.html#call">call</a>() can cause an exception to occur in the script engine; in that case, <a href="qjsvalue.html#call">call</a>() returns the value that was thrown (typically an <code>Error</code> object). You can call <a href="qjsvalue.html#isError">isError</a>() on the return value to determine whether an exception occurred.</p>
<p><b>See also </b><a href="qjsvalue.html#call">call</a>().</p>
<!-- @@@callWithInstance -->
<!-- $$$deleteProperty[overload1]$$$deletePropertyconstQString& -->
<h3 class="fn" id="deleteProperty"><a name="deleteProperty"></a><span class="type">bool</span> QJSValue::<span class="name">deleteProperty</span>(const <span class="type">QString</span> &<i> name</i>)</h3>
<p>Attempts to delete this object's property of the given <i>name</i>. Returns true if the property was deleted, otherwise returns false.</p>
<p>The behavior of this function is consistent with the JavaScript delete operator. In particular:</p>
<ul>
<li>Non-configurable properties cannot be deleted.</li>
<li>This function will return true even if this object doesn't have a property of the given <i>name</i> (i.e., non-existent properties are "trivially deletable").</li>
<li>If this object doesn't have an own property of the given <i>name</i>, but an object in the <a href="qjsvalue.html#prototype">prototype</a>() chain does, the prototype object's property is not deleted, and this function returns true.</li>
</ul>
<p><b>See also </b><a href="qjsvalue.html#setProperty">setProperty</a>() and <a href="qjsvalue.html#hasOwnProperty">hasOwnProperty</a>().</p>
<!-- @@@deleteProperty -->
<!-- $$$equals[overload1]$$$equalsconstQJSValue& -->
<h3 class="fn" id="equals"><a name="equals"></a><span class="type">bool</span> QJSValue::<span class="name">equals</span>(const <span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> &<i> other</i>) const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> is equal to <i>other</i>, otherwise returns false. The comparison follows the behavior described in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMA-262</a> section 11.9.3, "The Abstract Equality Comparison Algorithm".</p>
<p>This function can return true even if the type of this <a href="qjsvalue.html">QJSValue</a> is different from the type of the <i>other</i> value; i.e. the comparison is not strict. For example, comparing the number 9 to the string "9" returns true; comparing an undefined value to a null value returns true; comparing a <code>Number</code> object whose primitive value is 6 to a <code>String</code> object whose primitive value is "6" returns true; and comparing the number 1 to the boolean value <code>true</code> returns true. If you want to perform a comparison without such implicit value conversion, use <a href="qjsvalue.html#strictlyEquals">strictlyEquals</a>().</p>
<p>Note that if this <a href="qjsvalue.html">QJSValue</a> or the <i>other</i> value are objects, calling this function has side effects on the script engine, since the engine will call the object's valueOf() function (and possibly <a href="qjsvalue.html#toString">toString</a>()) in an attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception).</p>
<p><b>See also </b><a href="qjsvalue.html#strictlyEquals">strictlyEquals</a>().</p>
<!-- @@@equals -->
<!-- $$$hasOwnProperty[overload1]$$$hasOwnPropertyconstQString& -->
<h3 class="fn" id="hasOwnProperty"><a name="hasOwnProperty"></a><span class="type">bool</span> QJSValue::<span class="name">hasOwnProperty</span>(const <span class="type">QString</span> &<i> name</i>) const</h3>
<p>Returns true if this object has an own (not prototype-inherited) property of the given <i>name</i>, otherwise returns false.</p>
<p><b>See also </b><a href="qjsvalue.html#property">property</a>() and <a href="qjsvalue.html#hasProperty">hasProperty</a>().</p>
<!-- @@@hasOwnProperty -->
<!-- $$$hasProperty[overload1]$$$hasPropertyconstQString& -->
<h3 class="fn" id="hasProperty"><a name="hasProperty"></a><span class="type">bool</span> QJSValue::<span class="name">hasProperty</span>(const <span class="type">QString</span> &<i> name</i>) const</h3>
<p>Returns true if this object has a property of the given <i>name</i>, otherwise returns false.</p>
<p><b>See also </b><a href="qjsvalue.html#property">property</a>() and <a href="qjsvalue.html#hasOwnProperty">hasOwnProperty</a>().</p>
<!-- @@@hasProperty -->
<!-- $$$isArray[overload1]$$$isArray -->
<h3 class="fn" id="isArray"><a name="isArray"></a><span class="type">bool</span> QJSValue::<span class="name">isArray</span>() const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> is an object of the Array class; otherwise returns false.</p>
<p><b>See also </b><a href="qjsengine.html#newArray">QJSEngine::newArray</a>().</p>
<!-- @@@isArray -->
<!-- $$$isBool[overload1]$$$isBool -->
<h3 class="fn" id="isBool"><a name="isBool"></a><span class="type">bool</span> QJSValue::<span class="name">isBool</span>() const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> is of the primitive type Boolean; otherwise returns false.</p>
<p><b>See also </b><a href="qjsvalue.html#toBool">toBool</a>().</p>
<!-- @@@isBool -->
<!-- $$$isCallable[overload1]$$$isCallable -->
<h3 class="fn" id="isCallable"><a name="isCallable"></a><span class="type">bool</span> QJSValue::<span class="name">isCallable</span>() const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> can be called a function, otherwise returns false.</p>
<p><b>See also </b><a href="qjsvalue.html#call">call</a>().</p>
<!-- @@@isCallable -->
<!-- $$$isDate[overload1]$$$isDate -->
<h3 class="fn" id="isDate"><a name="isDate"></a><span class="type">bool</span> QJSValue::<span class="name">isDate</span>() const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> is an object of the Date class; otherwise returns false.</p>
<!-- @@@isDate -->
<!-- $$$isError[overload1]$$$isError -->
<h3 class="fn" id="isError"><a name="isError"></a><span class="type">bool</span> QJSValue::<span class="name">isError</span>() const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> is an object of the Error class; otherwise returns false.</p>
<p><b>See also </b><a href="qjsengine.html#script-exceptions">QJSEngine - Script Exceptions</a>.</p>
<!-- @@@isError -->
<!-- $$$isNull[overload1]$$$isNull -->
<h3 class="fn" id="isNull"><a name="isNull"></a><span class="type">bool</span> QJSValue::<span class="name">isNull</span>() const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> is of the primitive type Null; otherwise returns false.</p>
<!-- @@@isNull -->
<!-- $$$isNumber[overload1]$$$isNumber -->
<h3 class="fn" id="isNumber"><a name="isNumber"></a><span class="type">bool</span> QJSValue::<span class="name">isNumber</span>() const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> is of the primitive type Number; otherwise returns false.</p>
<p><b>See also </b><a href="qjsvalue.html#toNumber">toNumber</a>().</p>
<!-- @@@isNumber -->
<!-- $$$isObject[overload1]$$$isObject -->
<h3 class="fn" id="isObject"><a name="isObject"></a><span class="type">bool</span> QJSValue::<span class="name">isObject</span>() const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> is of the Object type; otherwise returns false.</p>
<p>Note that function values, variant values, and QObject values are objects, so this function returns true for such values.</p>
<p><b>See also </b><a href="qjsengine.html#newObject">QJSEngine::newObject</a>().</p>
<!-- @@@isObject -->
<!-- $$$isQObject[overload1]$$$isQObject -->
<h3 class="fn" id="isQObject"><a name="isQObject"></a><span class="type">bool</span> QJSValue::<span class="name">isQObject</span>() const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> is a QObject; otherwise returns false.</p>
<p>Note: This function returns true even if the QObject that this <a href="qjsvalue.html">QJSValue</a> wraps has been deleted.</p>
<p><b>See also </b><a href="qjsvalue.html#toQObject">toQObject</a>() and <a href="qjsengine.html#newQObject">QJSEngine::newQObject</a>().</p>
<!-- @@@isQObject -->
<!-- $$$isRegExp[overload1]$$$isRegExp -->
<h3 class="fn" id="isRegExp"><a name="isRegExp"></a><span class="type">bool</span> QJSValue::<span class="name">isRegExp</span>() const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> is an object of the RegExp class; otherwise returns false.</p>
<!-- @@@isRegExp -->
<!-- $$$isString[overload1]$$$isString -->
<h3 class="fn" id="isString"><a name="isString"></a><span class="type">bool</span> QJSValue::<span class="name">isString</span>() const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> is of the primitive type String; otherwise returns false.</p>
<p><b>See also </b><a href="qjsvalue.html#toString">toString</a>().</p>
<!-- @@@isString -->
<!-- $$$isUndefined[overload1]$$$isUndefined -->
<h3 class="fn" id="isUndefined"><a name="isUndefined"></a><span class="type">bool</span> QJSValue::<span class="name">isUndefined</span>() const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> is of the primitive type Undefined; otherwise returns false.</p>
<!-- @@@isUndefined -->
<!-- $$$isVariant[overload1]$$$isVariant -->
<h3 class="fn" id="isVariant"><a name="isVariant"></a><span class="type">bool</span> QJSValue::<span class="name">isVariant</span>() const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> is a variant value; otherwise returns false.</p>
<p><b>See also </b><a href="qjsvalue.html#toVariant">toVariant</a>().</p>
<!-- @@@isVariant -->
<!-- $$$property[overload1]$$$propertyconstQString& -->
<h3 class="fn" id="property"><a name="property"></a><span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> QJSValue::<span class="name">property</span>(const <span class="type">QString</span> &<i> name</i>) const</h3>
<p>Returns the value of this <a href="qjsvalue.html">QJSValue</a>'s property with the given <i>name</i>. If no such property exists, an undefined <a href="qjsvalue.html">QJSValue</a> is returned.</p>
<p>If the property is implemented using a getter function (i.e. has the PropertyGetter flag set), calling property() has side-effects on the script engine, since the getter function will be called (possibly resulting in an uncaught script exception). If an exception occurred, property() returns the value that was thrown (typically an <code>Error</code> object).</p>
<p><b>See also </b><a href="qjsvalue.html#setProperty">setProperty</a>(), <a href="qjsvalue.html#hasProperty">hasProperty</a>(), and <a href="qjsvalueiterator.html">QJSValueIterator</a>.</p>
<!-- @@@property -->
<!-- $$$property$$$propertyquint32 -->
<h3 class="fn" id="property-2"><a name="property-2"></a><span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> QJSValue::<span class="name">property</span>(<span class="type">quint32</span><i> arrayIndex</i>) const</h3>
<p>This is an overloaded function.</p>
<p>Returns the property at the given <i>arrayIndex</i>.</p>
<p>This function is provided for convenience and performance when working with array objects.</p>
<p>If this <a href="qjsvalue.html">QJSValue</a> is not an Array object, this function behaves as if <a href="qjsvalue.html#property">property</a>() was called with the string representation of <i>arrayIndex</i>.</p>
<!-- @@@property -->
<!-- $$$prototype[overload1]$$$prototype -->
<h3 class="fn" id="prototype"><a name="prototype"></a><span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> QJSValue::<span class="name">prototype</span>() const</h3>
<p>If this <a href="qjsvalue.html">QJSValue</a> is an object, returns the internal prototype (<code>__proto__</code> property) of this object; otherwise returns an undefined <a href="qjsvalue.html">QJSValue</a>.</p>
<p><b>See also </b><a href="qjsvalue.html#setPrototype">setPrototype</a>() and <a href="qjsvalue.html#isObject">isObject</a>().</p>
<!-- @@@prototype -->
<!-- $$$setProperty[overload1]$$$setPropertyconstQString&constQJSValue& -->
<h3 class="fn" id="setProperty"><a name="setProperty"></a><span class="type">void</span> QJSValue::<span class="name">setProperty</span>(const <span class="type">QString</span> &<i> name</i>, const <span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> &<i> value</i>)</h3>
<p>Sets the value of this <a href="qjsvalue.html">QJSValue</a>'s property with the given <i>name</i> to the given <i>value</i>.</p>
<p>If this <a href="qjsvalue.html">QJSValue</a> is not an object, this function does nothing.</p>
<p>If this <a href="qjsvalue.html">QJSValue</a> does not already have a property with name <i>name</i>, a new property is created.</p>
<p><b>See also </b><a href="qjsvalue.html#property">property</a>() and <a href="qjsvalue.html#deleteProperty">deleteProperty</a>().</p>
<!-- @@@setProperty -->
<!-- $$$setProperty$$$setPropertyquint32constQJSValue& -->
<h3 class="fn" id="setProperty-2"><a name="setProperty-2"></a><span class="type">void</span> QJSValue::<span class="name">setProperty</span>(<span class="type">quint32</span><i> arrayIndex</i>, const <span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> &<i> value</i>)</h3>
<p>This is an overloaded function.</p>
<p>Sets the property at the given <i>arrayIndex</i> to the given <i>value</i>.</p>
<p>This function is provided for convenience and performance when working with array objects.</p>
<p>If this <a href="qjsvalue.html">QJSValue</a> is not an Array object, this function behaves as if <a href="qjsvalue.html#setProperty">setProperty</a>() was called with the string representation of <i>arrayIndex</i>.</p>
<!-- @@@setProperty -->
<!-- $$$setPrototype[overload1]$$$setPrototypeconstQJSValue& -->
<h3 class="fn" id="setPrototype"><a name="setPrototype"></a><span class="type">void</span> QJSValue::<span class="name">setPrototype</span>(const <span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> &<i> prototype</i>)</h3>
<p>If this <a href="qjsvalue.html">QJSValue</a> is an object, sets the internal prototype (<code>__proto__</code> property) of this object to be <i>prototype</i>; if the <a href="qjsvalue.html">QJSValue</a> is null, it sets the prototype to null; otherwise does nothing.</p>
<p>The internal prototype should not be confused with the public property with name "prototype"; the public prototype is usually only set on functions that act as constructors.</p>
<p><b>See also </b><a href="qjsvalue.html#prototype">prototype</a>() and <a href="qjsvalue.html#isObject">isObject</a>().</p>
<!-- @@@setPrototype -->
<!-- $$$strictlyEquals[overload1]$$$strictlyEqualsconstQJSValue& -->
<h3 class="fn" id="strictlyEquals"><a name="strictlyEquals"></a><span class="type">bool</span> QJSValue::<span class="name">strictlyEquals</span>(const <span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> &<i> other</i>) const</h3>
<p>Returns true if this <a href="qjsvalue.html">QJSValue</a> is equal to <i>other</i> using strict comparison (no conversion), otherwise returns false. The comparison follows the behavior described in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMA-262</a> section 11.9.6, "The Strict Equality Comparison Algorithm".</p>
<p>If the type of this <a href="qjsvalue.html">QJSValue</a> is different from the type of the <i>other</i> value, this function returns false. If the types are equal, the result depends on the type, as shown in the following table:</p>
<div class="table"><table class="generic">
<thead><tr class="qt-style"><th >Type</th><th >Result</th></tr></thead>
<tr valign="top" class="odd"><td >Undefined</td><td >true</td></tr>
<tr valign="top" class="even"><td >Null</td><td >true</td></tr>
<tr valign="top" class="odd"><td >Boolean</td><td >true if both values are true, false otherwise</td></tr>
<tr valign="top" class="even"><td >Number</td><td >false if either value is NaN (Not-a-Number); true if values are equal, false otherwise</td></tr>
<tr valign="top" class="odd"><td >String</td><td >true if both values are exactly the same sequence of characters, false otherwise</td></tr>
<tr valign="top" class="even"><td >Object</td><td >true if both values refer to the same object, false otherwise</td></tr>
</table></div>
<p><b>See also </b><a href="qjsvalue.html#equals">equals</a>().</p>
<!-- @@@strictlyEquals -->
<!-- $$$toBool[overload1]$$$toBool -->
<h3 class="fn" id="toBool"><a name="toBool"></a><span class="type">bool</span> QJSValue::<span class="name">toBool</span>() const</h3>
<p>Returns the boolean value of this <a href="qjsvalue.html">QJSValue</a>, using the conversion rules described in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMA-262</a> section 9.2, "ToBoolean".</p>
<p>Note that if this <a href="qjsvalue.html">QJSValue</a> is an object, calling this function has side effects on the script engine, since the engine will call the object's valueOf() function (and possibly <a href="qjsvalue.html#toString">toString</a>()) in an attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception).</p>
<p><b>See also </b><a href="qjsvalue.html#isBool">isBool</a>().</p>
<!-- @@@toBool -->
<!-- $$$toDateTime[overload1]$$$toDateTime -->
<h3 class="fn" id="toDateTime"><a name="toDateTime"></a><span class="type">QDateTime</span> QJSValue::<span class="name">toDateTime</span>() const</h3>
<p>Returns a QDateTime representation of this value, in local time. If this <a href="qjsvalue.html">QJSValue</a> is not a date, or the value of the date is NaN (Not-a-Number), an invalid QDateTime is returned.</p>
<p><b>See also </b><a href="qjsvalue.html#isDate">isDate</a>().</p>
<!-- @@@toDateTime -->
<!-- $$$toInt[overload1]$$$toInt -->
<h3 class="fn" id="toInt"><a name="toInt"></a><span class="type">qint32</span> QJSValue::<span class="name">toInt</span>() const</h3>
<p>Returns the signed 32-bit integer value of this <a href="qjsvalue.html">QJSValue</a>, using the conversion rules described in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMA-262</a> section 9.5, "ToInt32".</p>
<p>Note that if this <a href="qjsvalue.html">QJSValue</a> is an object, calling this function has side effects on the script engine, since the engine will call the object's valueOf() function (and possibly <a href="qjsvalue.html#toString">toString</a>()) in an attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception).</p>
<p><b>See also </b><a href="qjsvalue.html#toNumber">toNumber</a>() and <a href="qjsvalue.html#toUInt">toUInt</a>().</p>
<!-- @@@toInt -->
<!-- $$$toNumber[overload1]$$$toNumber -->
<h3 class="fn" id="toNumber"><a name="toNumber"></a><span class="type">double</span> QJSValue::<span class="name">toNumber</span>() const</h3>
<p>Returns the number value of this <a href="qjsvalue.html">QJSValue</a>, as defined in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMA-262</a> section 9.3, "ToNumber".</p>
<p>Note that if this <a href="qjsvalue.html">QJSValue</a> is an object, calling this function has side effects on the script engine, since the engine will call the object's valueOf() function (and possibly <a href="qjsvalue.html#toString">toString</a>()) in an attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception).</p>
<p><b>See also </b><a href="qjsvalue.html#isNumber">isNumber</a>(), <a href="qjsvalue.html#toInt">toInt</a>(), and <a href="qjsvalue.html#toUInt">toUInt</a>().</p>
<!-- @@@toNumber -->
<!-- $$$toQObject[overload1]$$$toQObject -->
<h3 class="fn" id="toQObject"><a name="toQObject"></a><span class="type">QObject</span> * QJSValue::<span class="name">toQObject</span>() const</h3>
<p>If this <a href="qjsvalue.html">QJSValue</a> is a QObject, returns the QObject pointer that the <a href="qjsvalue.html">QJSValue</a> represents; otherwise, returns 0.</p>
<p>If the QObject that this <a href="qjsvalue.html">QJSValue</a> wraps has been deleted, this function returns 0 (i.e. it is possible for toQObject() to return 0 even when <a href="qjsvalue.html#isQObject">isQObject</a>() returns true).</p>
<p><b>See also </b><a href="qjsvalue.html#isQObject">isQObject</a>().</p>
<!-- @@@toQObject -->
<!-- $$$toString[overload1]$$$toString -->
<h3 class="fn" id="toString"><a name="toString"></a><span class="type">QString</span> QJSValue::<span class="name">toString</span>() const</h3>
<p>Returns the string value of this <a href="qjsvalue.html">QJSValue</a>, as defined in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMA-262</a> section 9.8, "ToString".</p>
<p>Note that if this <a href="qjsvalue.html">QJSValue</a> is an object, calling this function has side effects on the script engine, since the engine will call the object's toString() function (and possibly valueOf()) in an attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception).</p>
<p><b>See also </b><a href="qjsvalue.html#isString">isString</a>().</p>
<!-- @@@toString -->
<!-- $$$toUInt[overload1]$$$toUInt -->
<h3 class="fn" id="toUInt"><a name="toUInt"></a><span class="type">quint32</span> QJSValue::<span class="name">toUInt</span>() const</h3>
<p>Returns the unsigned 32-bit integer value of this <a href="qjsvalue.html">QJSValue</a>, using the conversion rules described in <a href="http://www.ecma-international.org/publications/standards/Ecma-262.htm">ECMA-262</a> section 9.6, "ToUint32".</p>
<p>Note that if this <a href="qjsvalue.html">QJSValue</a> is an object, calling this function has side effects on the script engine, since the engine will call the object's valueOf() function (and possibly <a href="qjsvalue.html#toString">toString</a>()) in an attempt to convert the object to a primitive value (possibly resulting in an uncaught script exception).</p>
<p><b>See also </b><a href="qjsvalue.html#toNumber">toNumber</a>() and <a href="qjsvalue.html#toInt">toInt</a>().</p>
<!-- @@@toUInt -->
<!-- $$$toVariant[overload1]$$$toVariant -->
<h3 class="fn" id="toVariant"><a name="toVariant"></a><span class="type">QVariant</span> QJSValue::<span class="name">toVariant</span>() const</h3>
<p>Returns the QVariant value of this <a href="qjsvalue.html">QJSValue</a>, if it can be converted to a QVariant; otherwise returns an invalid QVariant. The conversion is performed according to the following table:</p>
<div class="table"><table class="generic">
<thead><tr class="qt-style"><th >Input Type</th><th >Result</th></tr></thead>
<tr valign="top" class="odd"><td >Undefined</td><td >An invalid QVariant.</td></tr>
<tr valign="top" class="even"><td >Null</td><td >A QVariant containing a null pointer (QMetaType::VoidStar).</td></tr>
<tr valign="top" class="odd"><td >Boolean</td><td >A QVariant containing the value of the boolean.</td></tr>
<tr valign="top" class="even"><td >Number</td><td >A QVariant containing the value of the number.</td></tr>
<tr valign="top" class="odd"><td >String</td><td >A QVariant containing the value of the string.</td></tr>
<tr valign="top" class="even"><td >QVariant Object</td><td >The result is the QVariant value of the object (no conversion).</td></tr>
<tr valign="top" class="odd"><td >QObject Object</td><td >A QVariant containing a pointer to the QObject.</td></tr>
<tr valign="top" class="even"><td >Date Object</td><td >A QVariant containing the date value (<a href="qjsvalue.html#toDateTime">toDateTime</a>()).</td></tr>
<tr valign="top" class="odd"><td >RegExp Object</td><td >A QVariant containing the regular expression value.</td></tr>
<tr valign="top" class="even"><td >Array Object</td><td >The array is converted to a QVariantList. Each element is converted to a QVariant, recursively; cyclic references are not followed.</td></tr>
<tr valign="top" class="odd"><td >Object</td><td >The object is converted to a QVariantMap. Each property is converted to a QVariant, recursively; cyclic references are not followed.</td></tr>
</table></div>
<p><b>See also </b><a href="qjsvalue.html#isVariant">isVariant</a>().</p>
<!-- @@@toVariant -->
<!-- $$$operator=[overload1]$$$operator=QJSValue&& -->
<h3 class="fn" id="operator-eq"><a name="operator-eq"></a><span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> & QJSValue::<span class="name">operator=</span>(<span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> &&<i> other</i>)</h3>
<p>Move-assigns <i>other</i> to this <a href="qjsvalue.html">QJSValue</a> object.</p>
<!-- @@@operator= -->
<!-- $$$operator=$$$operator=constQJSValue& -->
<h3 class="fn" id="operator-eq-2"><a name="operator-eq-2"></a><span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> & QJSValue::<span class="name">operator=</span>(const <span class="type"><a href="qjsvalue.html#QJSValue">QJSValue</a></span> &<i> other</i>)</h3>
<p>Assigns the <i>other</i> value to this <a href="qjsvalue.html">QJSValue</a>.</p>
<p>Note that if <i>other</i> is an object (<a href="qjsvalue.html#isObject">isObject</a>() returns true), only a reference to the underlying object will be assigned; the object itself will not be copied.</p>
<!-- @@@operator= -->
</div>
</div>
</div>
</div>
</div>
</div>
<div class="footer">
<p>
<acronym title="Copyright">©</acronym> 2015 The Qt Company Ltd.
Documentation contributions included herein are the copyrights of
their respective owners.<br> 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.<br> 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. </p>
</div>
</body>
</html>
|