<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>Qt Bindings Reference Documentation</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <h1 align="center">Qt Script Qt Bindings Reference Documentation</h1> <h3>Packages</h3> <ul> <li><b><a href="com_trolltech_qt_core.html">com.trolltech.qt.core</a></b></li> <li><b><a href="com_trolltech_qt_gui.html">com.trolltech.qt.gui</a></b></li> <li><b><a href="com_trolltech_qt_network.html">com.trolltech.qt.network</a></b></li> <li><b><a href="com_trolltech_qt_opengl.html">com.trolltech.qt.opengl</a></b></li> <li><b><a href="com_trolltech_qt_phonon.html">com.trolltech.qt.phonon</a></b></li> <li><b><a href="com_trolltech_qt_sql.html">com.trolltech.qt.sql</a></b></li> <li><b><a href="com_trolltech_qt_svg.html">com.trolltech.qt.svg</a></b></li> <li><b><a href="com_trolltech_qt_uitools.html">com.trolltech.qt.uitools</a></b></li> <li><b><a href="com_trolltech_qt_webkit.html">com.trolltech.qt.webkit</a></b></li> <li><b><a href="com_trolltech_qt_xml.html">com.trolltech.qt.xml</a></b></li> <li><b><a href="com_trolltech_qt_xmlpatterns.html">com.trolltech.qt.xmlpatterns</a></b></li> </ul> <h3><a href="classes.html">All Classes</a></h3> <h3><a href="../examples">Examples</a></h3> <h3>Getting Started</h3> <p>Using the Qt API in Qt Script is very similar to C++. <pre>var f = new QFile("foo.txt");</pre> C++ enum values are mapped to properties of the script constructor function; e.g. QIODevice::ReadOnly becomes QIODevice.ReadOnly.</p> <pre>f.open(new QIODevice.OpenMode(QIODevice.ReadOnly));</pre> <p>Each C++ flag type is mapped to a property of the script constructor function; e.g. QIODevice::OpenMode becomes QIODevice.OpenMode. Such a property is a constructor function that takes one or more enum values and constructs a flags instance by OR'ing the arguments together.</p> <pre>var ts = new QTextStream(f); ts.writeString("Boo");</pre> <p>C++ streaming operators are normally mapped to readT() and writeT() functions.</p> <pre>f.close();</pre> <p>In Qt Script, all objects are allocated on the heap; objects that are no longer referenced are garbage collected sometime in the future; therefore, make sure to explicitly free up resources if you can. (Without the call to close(), the underlying file would remain open until the file object is garbage collected.)</p> <h3><a href="http://doc.trolltech.com/latest">Qt Reference Documentation</a></h3> </body> </html>