Sophie

Sophie

distrib > Mageia > 4 > i586 > by-pkgid > 28b9e36e96ce34b2567ae5b47a27b2c5 > files > 603

python-qt4-doc-4.10.3-3.mga4.noarch.rpm

<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html><head><title>QDeclarativeScriptString Class Reference</title><style>h3.fn,span.fn { margin-left: 1cm; text-indent: -1cm }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
td.postheader { font-family: sans-serif }
tr.address { font-family: sans-serif }
body { background: #ffffff; color: black; }
</style></head><body><table border="0" cellpadding="0" cellspacing="0" width="100%"><tr /><td align="left" valign="top" width="32"><img align="left" border="0" height="32" src="images/rb-logo.png" width="32" /></td><td width="1">&#160;&#160;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&#160;&#183; <a href="classes.html"><font color="#004faf">All Classes</font></a>&#160;&#183; <a href="modules.html"><font color="#004faf">Modules</font></a></td></table><h1 align="center">QDeclarativeScriptString Class Reference<br /><sup><sup>[<a href="qtdeclarative.html">QtDeclarative</a> module]</sup></sup></h1><p>The QDeclarativeScriptString class encapsulates a script and its
context. <a href="#details">More...</a></p>

<h3>Methods</h3><ul><li><div class="fn" /><b><a href="qdeclarativescriptstring.html#QDeclarativeScriptString">__init__</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdeclarativescriptstring.html#QDeclarativeScriptString-2">__init__</a></b> (<i>self</i>, QDeclarativeScriptString)</li><li><div class="fn" />QDeclarativeContext <b><a href="qdeclarativescriptstring.html#context">context</a></b> (<i>self</i>)</li><li><div class="fn" />QObject <b><a href="qdeclarativescriptstring.html#scopeObject">scopeObject</a></b> (<i>self</i>)</li><li><div class="fn" />QString <b><a href="qdeclarativescriptstring.html#script">script</a></b> (<i>self</i>)</li><li><div class="fn" /><b><a href="qdeclarativescriptstring.html#setContext">setContext</a></b> (<i>self</i>, QDeclarativeContext)</li><li><div class="fn" /><b><a href="qdeclarativescriptstring.html#setScopeObject">setScopeObject</a></b> (<i>self</i>, QObject)</li><li><div class="fn" /><b><a href="qdeclarativescriptstring.html#setScript">setScript</a></b> (<i>self</i>, QString)</li></ul><a name="details" /><hr /><h2>Detailed Description</h2><p>The QDeclarativeScriptString class encapsulates a script and its
context.</p>
<p>QDeclarativeScriptString is used to create <a href="qobject.html">QObject</a> properties that accept a script
"assignment" from QML.</p>
<p>Normally, the following QML would result in a binding being
established for the <tt>script</tt> property; i.e. <tt>script</tt>
would be assigned the value obtained from running <tt>myObj.value =
Math.max(myValue, 100)</tt></p>
<pre class="qml">
 <span class="type">MyType</span> {
     <span class="name">script</span>: <span class="name">myObj</span>.<span class="name">value</span> <span class="operator">=</span> <span class="name">Math</span>.<span class="name">max</span>(<span class="name">myValue</span>, <span class="number">100</span>)
 }
</pre>
<p>If instead the property had a type of QDeclarativeScriptString,
the script itself -- <i>myObj.value = Math.max(myValue, 100)</i> --
would be passed to the <tt>script</tt> property and the class could
choose how to handle it. Typically, the class will evaluate the
script at some later time using a <a href="qdeclarativeexpression.html">QDeclarativeExpression</a>.</p>
<pre class="cpp">
 <span class="type"><a href="qdeclarativeexpression.html">QDeclarativeExpression</a></span> expr(scriptString<span class="operator">.</span>context()<span class="operator">,</span> scriptString<span class="operator">.</span>script()<span class="operator">,</span> scriptStr<span class="operator">.</span>scopeObject());
 expr<span class="operator">.</span>value();
</pre><hr /><h2>Method Documentation</h2><h3 class="fn"><a name="QDeclarativeScriptString" />QDeclarativeScriptString.__init__ (<i>self</i>)</h3><p>Constructs an empty instance.</p>


<h3 class="fn"><a name="QDeclarativeScriptString-2" />QDeclarativeScriptString.__init__ (<i>self</i>, <a href="qdeclarativescriptstring.html">QDeclarativeScriptString</a>)</h3><p>Copies <i>other</i>.</p>


<h3 class="fn"><a name="context" /><a href="qdeclarativecontext.html">QDeclarativeContext</a> QDeclarativeScriptString.context (<i>self</i>)</h3><p>Returns the context for the script.</p>
<p><b>See also</b> <a href="qdeclarativescriptstring.html#setContext">setContext</a>().</p>


<h3 class="fn"><a name="scopeObject" /><a href="qobject.html">QObject</a> QDeclarativeScriptString.scopeObject (<i>self</i>)</h3><p>Returns the scope object for the script.</p>
<p><b>See also</b> <a href="qdeclarativescriptstring.html#setScopeObject">setScopeObject</a>().</p>


<h3 class="fn"><a name="script" />QString QDeclarativeScriptString.script (<i>self</i>)</h3><p>Returns the script text.</p>
<p><b>See also</b> <a href="qdeclarativescriptstring.html#setScript">setScript</a>().</p>


<h3 class="fn"><a name="setContext" />QDeclarativeScriptString.setContext (<i>self</i>, <a href="qdeclarativecontext.html">QDeclarativeContext</a>)</h3><p>Sets the <i>context</i> for the script.</p>
<p><b>See also</b> <a href="qdeclarativescriptstring.html#context">context</a>().</p>


<h3 class="fn"><a name="setScopeObject" />QDeclarativeScriptString.setScopeObject (<i>self</i>, <a href="qobject.html">QObject</a>)</h3><p>Sets the scope <i>object</i> for the script.</p>
<p><b>See also</b> <a href="qdeclarativescriptstring.html#scopeObject">scopeObject</a>().</p>


<h3 class="fn"><a name="setScript" />QDeclarativeScriptString.setScript (<i>self</i>, QString)</h3><p>Sets the <i>script</i> text.</p>
<p><b>See also</b> <a href="qdeclarativescriptstring.html#script">script</a>().</p>


<address><hr /><div align="center"><table border="0" cellspacing="0" width="100%"><tr class="address"><td align="left" width="25%">PyQt&#160;4.10.3 for X11</td><td align="center" width="50%">Copyright &#169; <a href="http://www.riverbankcomputing.com">Riverbank&#160;Computing&#160;Ltd</a> and <a href="http://www.qtsoftware.com">Nokia</a> 2012</td><td align="right" width="25%">Qt&#160;4.8.5</td></tr></table></div></address></body></html>