Sophie

Sophie

distrib > Fedora > 18 > x86_64 > by-pkgid > ff187cb994c94c614ecc64c5a8528b1b > files > 6280

qt-doc-4.8.5-10.fc18.noarch.rpm

<?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" />
<!-- qscriptclass.cpp -->
  <title>Qt 4.8: QScriptClass Class Reference</title>
  <link rel="stylesheet" type="text/css" href="style/style.css" />
  <script src="scripts/jquery.js" type="text/javascript"></script>
  <script src="scripts/functions.js" type="text/javascript"></script>
  <link rel="stylesheet" type="text/css" href="style/superfish.css" />
  <link rel="stylesheet" type="text/css" href="style/narrow.css" />
  <!--[if IE]>
<meta name="MSSmartTagsPreventParsing" content="true">
<meta http-equiv="imagetoolbar" content="no">
<![endif]-->
<!--[if lt IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie6.css">
<![endif]-->
<!--[if IE 7]>
<link rel="stylesheet" type="text/css" href="style/style_ie7.css">
<![endif]-->
<!--[if IE 8]>
<link rel="stylesheet" type="text/css" href="style/style_ie8.css">
<![endif]-->

<script src="scripts/superfish.js" type="text/javascript"></script>
<script src="scripts/narrow.js" type="text/javascript"></script>

</head>
<body class="" onload="CheckEmptyAndLoadList();">
 <div class="header" id="qtdocheader">
    <div class="content"> 
    <div id="nav-logo">
      <a href="index.html">Home</a></div>
    <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a>
    <div id="narrowsearch"></div>
    <div id="nav-topright">
      <ul>
        <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li>
        <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li>
        <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/">
          DOC</a></li>
        <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li>
      </ul>
    </div>
    <div id="shortCut">
      <ul>
        <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li>
        <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS        </a></li>
      </ul>
     </div>
 <ul class="sf-menu" id="narrowmenu"> 
             <li><a href="#">API Lookup</a> 
                 <ul> 
                     <li><a href="classes.html">Class index</a></li> 
           <li><a href="functions.html">Function index</a></li> 
           <li><a href="modules.html">Modules</a></li> 
           <li><a href="namespaces.html">Namespaces</a></li> 
           <li><a href="qtglobal.html">Global Declarations</a></li> 
           <li><a href="qdeclarativeelements.html">QML elements</a></li> 
             </ul> 
             </li> 
             <li><a href="#">Qt Topics</a> 
                 <ul> 
                        <li><a href="qt-basic-concepts.html">Programming with Qt</a></li>  
                        <li><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li>  
                        <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li>  
                        <li><a href="supported-platforms.html">Supported Platforms</a></li>  
                        <li><a href="technology-apis.html">Qt and Key Technologies</a></li>  
                        <li><a href="best-practices.html">How-To's and Best Practices</a></li>  
              </ul> 
                 </li> 
                 <li><a href="#">Examples</a> 
                     <ul> 
                       <li><a href="all-examples.html">Examples</a></li> 
                       <li><a href="tutorials.html">Tutorials</a></li> 
                       <li><a href="demos.html">Demos</a></li> 
                       <li><a href="qdeclarativeexamples.html">QML Examples</a></li> 
                </ul> 
                     </li> 
                 </ul> 
    </div>
  </div>
  <div class="wrapper">
    <div class="hd">
      <span></span>
    </div>
    <div class="bd group">
      <div class="sidebar">
        <div class="searchlabel">
          Search index:</div>
        <div class="search" id="sidebarsearch">
          <form id="qtdocsearch" action="" onsubmit="return false;">
            <fieldset>
              <input type="text" name="searchstring" id="pageType" value="" />
 <div id="resultdialog"> 
 <a href="#" id="resultclose">Close</a> 
 <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> 
 <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span>&nbsp;results:</p> 
 <ul id="resultlist" class="all"> 
 </ul> 
 </div> 
            </fieldset>
          </form>
        </div>
        <div class="box first bottombar" id="lookup">
          <h2 title="API Lookup"><span></span>
            API Lookup</h2>
          <div  id="list001" class="list">
          <ul id="ul001" >
              <li class="defaultLink"><a href="classes.html">Class index</a></li>
              <li class="defaultLink"><a href="functions.html">Function index</a></li>
              <li class="defaultLink"><a href="modules.html">Modules</a></li>
              <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li>
              <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li>
              <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li>
            </ul> 
          </div>
        </div>
        <div class="box bottombar" id="topics">
          <h2 title="Qt Topics"><span></span>
            Qt Topics</h2>
          <div id="list002" class="list">
            <ul id="ul002" >
               <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> 
               <li class="defaultLink"><a href="qtquick.html">Device UIs &amp; Qt Quick</a></li> 
               <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> 
               <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li>  
               <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> 
               <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> 
            </ul>  
          </div>
        </div>
        <div class="box" id="examples">
          <h2 title="Examples"><span></span>
            Examples</h2>
          <div id="list003" class="list">
        <ul id="ul003">
              <li class="defaultLink"><a href="all-examples.html">Examples</a></li>
              <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li>
              <li class="defaultLink"><a href="demos.html">Demos</a></li>
              <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li>
            </ul> 
          </div>
        </div>
      </div>
      <div class="wrap">
        <div class="toolbar">
          <div class="breadcrumb toolblock">
            <ul>
              <li class="first"><a href="index.html">Home</a></li>
              <!--  Breadcrumbs go here -->
<li><a href="modules.html">Modules</a></li>
<li><a href="qtscript.html">QtScript</a></li>
<li>QScriptClass</li>
            </ul>
          </div>
          <div class="toolbuttons toolblock">
            <ul>
              <li id="smallA" class="t_button">A</li>
              <li id="medA" class="t_button active">A</li>
              <li id="bigA" class="t_button">A</li>
              <li id="print" class="t_button"><a href="javascript:this.print();">
                <span>Print</span></a></li>
            </ul>
        </div>
        </div>
        <div class="content mainContent">
<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>
<h1 class="title">QScriptClass Class Reference</h1>
<!-- $$$QScriptClass-brief -->
<p>The QScriptClass class provides an interface for defining custom behavior of (a class of) Qt Script objects. <a href="#details">More...</a></p>
<!-- @@@QScriptClass -->
<pre class="cpp"> <span class="preprocessor">#include &lt;QScriptClass&gt;</span></pre><p>This class was introduced in Qt 4.4.</p>
<ul>
<li><a href="qscriptclass-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h2>Public Types</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#Extension-enum">Extension</a></b> { Callable, HasInstance }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> enum </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#QueryFlag-enum">QueryFlag</a></b> { HandlesReadAccess, HandlesWriteAccess }</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> flags </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#QueryFlag-enum">QueryFlags</a></b></td></tr>
</table>
<a name="public-functions"></a>
<h2>Public Functions</h2>
<table class="alignedsummary">
<tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#QScriptClass">QScriptClass</a></b> ( QScriptEngine * <i>engine</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#dtor.QScriptClass">~QScriptClass</a></b> ()</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> QScriptEngine * </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#engine">engine</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QVariant </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#extension">extension</a></b> ( Extension <i>extension</i>, const QVariant &amp; <i>argument</i> = QVariant() )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QString </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#name">name</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QScriptClassPropertyIterator * </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#newIterator">newIterator</a></b> ( const QScriptValue &amp; <i>object</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QScriptValue </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#property">property</a></b> ( const QScriptValue &amp; <i>object</i>, const QScriptString &amp; <i>name</i>, uint <i>id</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QScriptValue::PropertyFlags </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#propertyFlags">propertyFlags</a></b> ( const QScriptValue &amp; <i>object</i>, const QScriptString &amp; <i>name</i>, uint <i>id</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QScriptValue </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#prototype">prototype</a></b> () const</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual QueryFlags </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#queryProperty">queryProperty</a></b> ( const QScriptValue &amp; <i>object</i>, const QScriptString &amp; <i>name</i>, QueryFlags <i>flags</i>, uint * <i>id</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#setProperty">setProperty</a></b> ( QScriptValue &amp; <i>object</i>, const QScriptString &amp; <i>name</i>, uint <i>id</i>, const QScriptValue &amp; <i>value</i> )</td></tr>
<tr><td class="memItemLeft rightAlign topAlign"> virtual bool </td><td class="memItemRight bottomAlign"><b><a href="qscriptclass.html#supportsExtension">supportsExtension</a></b> ( Extension <i>extension</i> ) const</td></tr>
</table>
<a name="details"></a>
<!-- $$$QScriptClass-description -->
<div class="descr">
<h2>Detailed Description</h2>
<p>The QScriptClass class provides an interface for defining custom behavior of (a class of) Qt Script objects.</p>
<p>The QScriptClass class defines an interface for handling various aspects of interaction with the Qt Script objects associated with the class. Such objects are created by calling <a href="qscriptengine.html#newObject">QScriptEngine::newObject</a>(), passing a pointer to the QScriptClass as argument.</p>
<p>By subclassing QScriptClass, you can define precisely how access to properties of the objects that use your class is handled. This enables a fully dynamic handling of properties, e.g&#x2e; it's more powerful than <a href="qscriptengine.html#newQObject">QScriptEngine::newQObject</a>(). For example, you can use QScriptClass to implement array-type objects (i.e&#x2e; objects that handle the <tt>length</tt> property, and properties whose names are valid array indexes, in a special way), or to implement a &quot;live&quot; (runtime-defined) proxy to an underlying object.</p>
<p>If you just need to handle access to a set of properties that are known at the time an object is created (i.e&#x2e; &quot;semi-statically&quot;), you might consider using <a href="qscriptvalue.html#setProperty">QScriptValue::setProperty</a>() to define getter/setter functions for the relevant properties, rather than subclassing QScriptClass.</p>
<p>Reimplement <a href="qscriptclass.html#queryProperty">queryProperty</a>() to specify which properties are handled in a custom way by your script class (i.e&#x2e; should be <b>delegated</b> to the QScriptClass), and which properties should be handled just like normal Qt Script object properties.</p>
<p>Reimplement <a href="qscriptclass.html#property">property</a>() and <a href="qscriptclass.html#setProperty">setProperty</a>() to perform the actual access (read or write) to the properties that your class handles. Additionally, you can reimplement <a href="qscriptclass.html#propertyFlags">propertyFlags</a>() to specify custom flags for your properties.</p>
<p>Reimplement <a href="qscriptclass.html#newIterator">newIterator</a>() to provide an iterator for objects of your custom class. This is only necessary if objects of your class can have custom properties that you want to be reported when an object is used together with the <a href="qscriptvalueiterator.html">QScriptValueIterator</a> class, or when an object is used in a for-in enumeration statement in a script.</p>
<p>When implementing custom classes of objects, you typically use <a href="qscriptvalue.html#setData">QScriptValue::setData</a>() to store instance-specific data as part of object initialization; the data won't be accessible from scripts directly, but you can access it in e.g&#x2e; your reimplementations of <a href="qscriptclass.html#property">property</a>() and <a href="qscriptclass.html#setProperty">setProperty</a>() (by calling <a href="qscriptvalue.html#data">QScriptValue::data</a>()) to perform custom processing.</p>
<p>Reimplement <a href="qscriptclass.html#prototype">prototype</a>() to provide a custom prototype object for your script class.</p>
<p>Reimplement <a href="qscriptclass.html#supportsExtension">supportsExtension</a>() and <a href="qscriptclass.html#extension">extension</a>() if your custom script class supports one or more of the extensions specified by the Extension enum.</p>
</div>
<p><b>See also </b><a href="qscriptclasspropertyiterator.html">QScriptClassPropertyIterator</a>, <a href="qscriptengine.html#newObject">QScriptEngine::newObject</a>(), and <a href="script-customclass.html">Custom Script Class Example</a>.</p>
<!-- @@@QScriptClass -->
<div class="types">
<h2>Member Type Documentation</h2>
<!-- $$$Extension$$$Callable$$$HasInstance -->
<h3 class="fn"><a name="Extension-enum"></a>enum QScriptClass::<span class="name">Extension</span></h3>
<p>This enum specifies the possible extensions to a <a href="qscriptclass.html">QScriptClass</a>.</p>
<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"><tt>QScriptClass::Callable</tt></td><td class="topAlign"><tt>0</tt></td><td class="topAlign">Instances of this class can be called as functions.</td></tr>
<tr><td class="topAlign"><tt>QScriptClass::HasInstance</tt></td><td class="topAlign"><tt>1</tt></td><td class="topAlign">Instances of this class implement [[HasInstance]].</td></tr>
</table>
<p><b>See also </b><a href="qscriptclass.html#extension">extension</a>().</p>
<!-- @@@Extension -->
<!-- $$$QueryFlag$$$HandlesReadAccess$$$HandlesWriteAccess -->
<h3 class="flags"><a name="QueryFlag-enum"></a>enum QScriptClass::<span class="name">QueryFlag</span><br/>flags QScriptClass::<span class="name">QueryFlags</span></h3>
<p>This enum describes flags that are used to query a <a href="qscriptclass.html">QScriptClass</a> regarding how access to a property should be handled.</p>
<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"><tt>QScriptClass::HandlesReadAccess</tt></td><td class="topAlign"><tt>0x01</tt></td><td class="topAlign">The <a href="qscriptclass.html">QScriptClass</a> handles read access to this property.</td></tr>
<tr><td class="topAlign"><tt>QScriptClass::HandlesWriteAccess</tt></td><td class="topAlign"><tt>0x02</tt></td><td class="topAlign">The <a href="qscriptclass.html">QScriptClass</a> handles write access to this property.</td></tr>
</table>
<p>The QueryFlags type is a typedef for <a href="qflags.html">QFlags</a>&lt;QueryFlag&gt;. It stores an OR combination of QueryFlag values.</p>
<p><b>See also </b><a href="qscriptclass.html#queryProperty">queryProperty</a>().</p>
<!-- @@@QueryFlag -->
</div>
<div class="func">
<h2>Member Function Documentation</h2>
<!-- $$$QScriptClass[overload1]$$$QScriptClassQScriptEngine* -->
<h3 class="fn"><a name="QScriptClass"></a>QScriptClass::<span class="name">QScriptClass</span> ( <span class="type"><a href="qscriptengine.html">QScriptEngine</a></span> * <i>engine</i> )</h3>
<p>Constructs a <a href="qscriptclass.html">QScriptClass</a> object to be used in the given <i>engine</i>.</p>
<p>The engine does not take ownership of the <a href="qscriptclass.html">QScriptClass</a> object.</p>
<!-- @@@QScriptClass -->
<!-- $$$~QScriptClass[overload1]$$$~QScriptClass -->
<h3 class="fn"><a name="dtor.QScriptClass"></a>QScriptClass::<span class="name">~QScriptClass</span> ()<tt> [virtual]</tt></h3>
<p>Destroys the <a href="qscriptclass.html">QScriptClass</a> object.</p>
<p>If a <a href="qscriptclass.html">QScriptClass</a> object is deleted before the associated <a href="qscriptclass.html#engine">engine</a>(), any Qt Script objects using the <a href="qscriptclass.html">QScriptClass</a> will be &quot;demoted&quot; to normal Qt Script objects.</p>
<!-- @@@~QScriptClass -->
<!-- $$$engine[overload1]$$$engine -->
<h3 class="fn"><a name="engine"></a><span class="type"><a href="qscriptengine.html">QScriptEngine</a></span> * QScriptClass::<span class="name">engine</span> () const</h3>
<p>Returns the engine that this <a href="qscriptclass.html">QScriptClass</a> is associated with.</p>
<!-- @@@engine -->
<!-- $$$extension[overload1]$$$extensionExtensionconstQVariant& -->
<h3 class="fn"><a name="extension"></a><span class="type"><a href="qvariant.html">QVariant</a></span> QScriptClass::<span class="name">extension</span> ( <span class="type"><a href="qscriptclass.html#Extension-enum">Extension</a></span> <i>extension</i>, const <span class="type"><a href="qvariant.html">QVariant</a></span> &amp; <i>argument</i> = QVariant() )<tt> [virtual]</tt></h3>
<p>This virtual function can be reimplemented in a <a href="qscriptclass.html">QScriptClass</a> subclass to provide support for extensions. The optional <i>argument</i> can be provided as input to the <i>extension</i>; the result must be returned in the form of a <a href="qvariant.html">QVariant</a>. You can call <a href="qscriptclass.html#supportsExtension">supportsExtension</a>() to check if an extension is supported by the <a href="qscriptclass.html">QScriptClass</a>. By default, no extensions are supported, and this function returns an invalid <a href="qvariant.html">QVariant</a>.</p>
<p>If you implement the Callable extension, Qt Script will call this function when an instance of your class is called as a function (e.g&#x2e; from a script or using <a href="qscriptvalue.html#call">QScriptValue::call</a>()). The <i>argument</i> will contain a pointer to the <a href="qscriptcontext.html">QScriptContext</a> that represents the function call, and you should return a <a href="qvariant.html">QVariant</a> that holds the result of the function call. In the following example the sum of the arguments to the script function are added up and returned:</p>
<pre class="cpp"> <span class="keyword">if</span> (extension <span class="operator">=</span><span class="operator">=</span> Callable) {
     <span class="type"><a href="qscriptcontext.html">QScriptContext</a></span> <span class="operator">*</span>context <span class="operator">=</span> qvariant_cast<span class="operator">&lt;</span><span class="type"><a href="qscriptcontext.html">QScriptContext</a></span><span class="operator">*</span><span class="operator">&gt;</span>(argument);
     <span class="type"><a href="qscriptengine.html">QScriptEngine</a></span> <span class="operator">*</span>engine <span class="operator">=</span> context<span class="operator">-</span><span class="operator">&gt;</span>engine();
     <span class="type">double</span> sum <span class="operator">=</span> <span class="number">0</span>;
     <span class="keyword">for</span> (<span class="type">int</span> i <span class="operator">=</span> <span class="number">0</span>; i <span class="operator">&lt;</span> context<span class="operator">-</span><span class="operator">&gt;</span>argumentCount(); <span class="operator">+</span><span class="operator">+</span>i)
         sum <span class="operator">+</span><span class="operator">=</span> context<span class="operator">-</span><span class="operator">&gt;</span>argument(i)<span class="operator">.</span>toNumber();
     <span class="keyword">return</span> sum;
 }</pre>
<p>If you implement the <a href="qscriptclass.html#Extension-enum">HasInstance</a> extension, Qt Script will call this function as part of evaluating the <tt>instanceof</tt> operator, as described in ECMA-262 Section 11.8&#x2e;6&#x2e; The <i>argument</i> is a QScriptValueList containing two items: The first item is the object that <a href="qscriptclass.html#Extension-enum">HasInstance</a> is being applied to (an instance of your class), and the second item can be any value. extension() should return true if the value delegates behavior to the object, false otherwise.</p>
<p><b>See also </b><a href="qscriptclass.html#supportsExtension">supportsExtension</a>().</p>
<!-- @@@extension -->
<!-- $$$name[overload1]$$$name -->
<h3 class="fn"><a name="name"></a><span class="type"><a href="qstring.html">QString</a></span> QScriptClass::<span class="name">name</span> () const<tt> [virtual]</tt></h3>
<p>Returns the name of the script class.</p>
<p>Qt Script uses this name to generate a default string representation of objects in case you do not provide a toString function.</p>
<p>The default implementation returns a null string.</p>
<!-- @@@name -->
<!-- $$$newIterator[overload1]$$$newIteratorconstQScriptValue& -->
<h3 class="fn"><a name="newIterator"></a><span class="type"><a href="qscriptclasspropertyiterator.html">QScriptClassPropertyIterator</a></span> * QScriptClass::<span class="name">newIterator</span> ( const <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> &amp; <i>object</i> )<tt> [virtual]</tt></h3>
<p>Returns an iterator for traversing custom properties of the given <i>object</i>.</p>
<p>The default implementation returns 0, meaning that there are no custom properties to traverse.</p>
<p>Reimplement this function if objects of your script class can have one or more custom properties (e.g&#x2e; those reported to be handled by <a href="qscriptclass.html#queryProperty">queryProperty</a>()) that you want to appear when an object's properties are enumerated (e.g&#x2e; by a for-in statement in a script).</p>
<p>Qt Script takes ownership of the new iterator object.</p>
<p><b>See also </b><a href="qscriptvalueiterator.html">QScriptValueIterator</a>.</p>
<!-- @@@newIterator -->
<!-- $$$property[overload1]$$$propertyconstQScriptValue&constQScriptString&uint -->
<h3 class="fn"><a name="property"></a><span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> QScriptClass::<span class="name">property</span> ( const <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> &amp; <i>object</i>, const <span class="type"><a href="qscriptstring.html">QScriptString</a></span> &amp; <i>name</i>, <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>id</i> )<tt> [virtual]</tt></h3>
<p>Returns the value of the property with the given <i>name</i> of the given <i>object</i>.</p>
<p>The <i>id</i> argument is only useful if you assigned a value to it in <a href="qscriptclass.html#queryProperty">queryProperty</a>().</p>
<p>The default implementation does nothing and returns an invalid <a href="qscriptvalue.html">QScriptValue</a>.</p>
<p><b>See also </b><a href="qscriptclass.html#setProperty">setProperty</a>() and <a href="qscriptclass.html#propertyFlags">propertyFlags</a>().</p>
<!-- @@@property -->
<!-- $$$propertyFlags[overload1]$$$propertyFlagsconstQScriptValue&constQScriptString&uint -->
<h3 class="fn"><a name="propertyFlags"></a><span class="type"><a href="qscriptvalue.html#PropertyFlag-enum">QScriptValue::PropertyFlags</a></span> QScriptClass::<span class="name">propertyFlags</span> ( const <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> &amp; <i>object</i>, const <span class="type"><a href="qscriptstring.html">QScriptString</a></span> &amp; <i>name</i>, <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>id</i> )<tt> [virtual]</tt></h3>
<p>Returns the flags of the property with the given <i>name</i> of the given <i>object</i>.</p>
<p>The <i>id</i> argument is only useful if you assigned a value to it in <a href="qscriptclass.html#queryProperty">queryProperty</a>().</p>
<p>The default implementation returns 0.</p>
<p><b>See also </b><a href="qscriptclass.html#property">property</a>().</p>
<!-- @@@propertyFlags -->
<!-- $$$prototype[overload1]$$$prototype -->
<h3 class="fn"><a name="prototype"></a><span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> QScriptClass::<span class="name">prototype</span> () const<tt> [virtual]</tt></h3>
<p>Returns the object to be used as the prototype of new instances of this class (created with <a href="qscriptengine.html#newObject">QScriptEngine::newObject</a>()).</p>
<p>The default implementation returns an invalid <a href="qscriptvalue.html">QScriptValue</a>, meaning that the standard Object prototype will be used. Reimplement this function to provide your own custom prototype.</p>
<p>Typically you initialize your prototype object in the constructor of your class, then return it in this function.</p>
<p>See the &quot;Making Use of Prototype-Based Inheritance&quot; section in the <a href="qtscript.html">QtScript</a> documentation for more information on how prototypes are used.</p>
<!-- @@@prototype -->
<!-- $$$queryProperty[overload1]$$$queryPropertyconstQScriptValue&constQScriptString&QueryFlagsuint* -->
<h3 class="fn"><a name="queryProperty"></a><span class="type"><a href="qscriptclass.html#QueryFlag-enum">QueryFlags</a></span> QScriptClass::<span class="name">queryProperty</span> ( const <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> &amp; <i>object</i>, const <span class="type"><a href="qscriptstring.html">QScriptString</a></span> &amp; <i>name</i>, <span class="type"><a href="qscriptclass.html#QueryFlag-enum">QueryFlags</a></span> <i>flags</i>, <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> * <i>id</i> )<tt> [virtual]</tt></h3>
<p>Queries this script class for how access to the property with the given <i>name</i> of the given <i>object</i> should be handled. The given <i>flags</i> specify the aspects of interest. This function should return a subset of <i>flags</i> to indicate which aspects of property access should be further handled by the script class.</p>
<p>For example, if the <i>flags</i> contain <a href="qscriptclass.html#QueryFlag-enum">HandlesReadAccess</a>, and you would like your class to handle the reading of the property (through the <a href="qscriptclass.html#property">property</a>() function), the returned flags should include <a href="qscriptclass.html#QueryFlag-enum">HandlesReadAccess</a>. If the returned flags do not contain <a href="qscriptclass.html#QueryFlag-enum">HandlesReadAccess</a>, the property will be handled as a normal script object property.</p>
<p>You can optionally use the <i>id</i> argument to store a value that will subsequently be passed on to functions such as <a href="qscriptclass.html#property">property</a>() and <a href="qscriptclass.html#setProperty">setProperty</a>().</p>
<p>The default implementation of this function returns 0.</p>
<p>Note: This function is only called if the given property isn't already a normal property of the object. For example, say you advertise that you want to handle read access to property <tt>foo</tt>, but not write access; if <tt>foo</tt> is then assigned a value, it will become a normal script object property, and subsequently you will no longer be queried regarding read access to <tt>foo</tt>.</p>
<p><b>See also </b><a href="qscriptclass.html#property">property</a>().</p>
<!-- @@@queryProperty -->
<!-- $$$setProperty[overload1]$$$setPropertyQScriptValue&constQScriptString&uintconstQScriptValue& -->
<h3 class="fn"><a name="setProperty"></a><span class="type">void</span> QScriptClass::<span class="name">setProperty</span> ( <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> &amp; <i>object</i>, const <span class="type"><a href="qscriptstring.html">QScriptString</a></span> &amp; <i>name</i>, <span class="type"><a href="qtglobal.html#uint-typedef">uint</a></span> <i>id</i>, const <span class="type"><a href="qscriptvalue.html">QScriptValue</a></span> &amp; <i>value</i> )<tt> [virtual]</tt></h3>
<p>Sets the property with the given <i>name</i> of the given <i>object</i> to the given <i>value</i>.</p>
<p>The <i>id</i> argument is only useful if you assigned a value to it in <a href="qscriptclass.html#queryProperty">queryProperty</a>().</p>
<p>The default implementation does nothing.</p>
<p>An invalid <i>value</i> represents a request to remove the property.</p>
<p><b>See also </b><a href="qscriptclass.html#property">property</a>().</p>
<!-- @@@setProperty -->
<!-- $$$supportsExtension[overload1]$$$supportsExtensionExtension -->
<h3 class="fn"><a name="supportsExtension"></a><span class="type">bool</span> QScriptClass::<span class="name">supportsExtension</span> ( <span class="type"><a href="qscriptclass.html#Extension-enum">Extension</a></span> <i>extension</i> ) const<tt> [virtual]</tt></h3>
<p>Returns true if the <a href="qscriptclass.html">QScriptClass</a> supports the given <i>extension</i>; otherwise, false is returned. By default, no extensions are supported.</p>
<p>Reimplement this function to indicate which extensions your custom class supports.</p>
<p><b>See also </b><a href="qscriptclass.html#extension">extension</a>().</p>
<!-- @@@supportsExtension -->
</div>
      </div>
    </div>
    </div> 
    <div class="ft">
      <span></span>
    </div>
  </div> 
  <div class="footer">
    <p>
      <acronym title="Copyright">&copy;</acronym> 2013 Digia Plc 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>
      Digia, Qt and their respective logos are trademarks of Digia Plc 
      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>

  <script src="scripts/functions.js" type="text/javascript"></script>
</body>
</html>