General Installation Information (for Qt 4.6)
In order to use Lively for Qt, follow the steps below:
- Install the Qt platform on your target computer or device.
- Add support for JavaScript bindings to the Qt environment
by running the
QtScriptGenerator
tool. - Use the generated
qs_eval
tool to run the system using the syntax shown in file"Qtly.bat"
. The general syntax is:
"qs_eval ...application files... QtInspector.js Qtly.js"
In order to run Lively for Qt without any applications or additional tools,
just say:
"qs_eval Qtly.js"
Note that you can also run Lively for Qt in any web browser using a Qt web browser plugin. Instructions for installing the necessary web browser plugin(s) will be available here later.
Installation instructions for Qt 4.5 are available here.
1. Installing the Qt Platform
The following sections contain instructions for the installation of Qt for Windows XP, Mac OS X 10.4 & 10.5, Ubuntu Linux 9.10 and Nokia's Maemo Platform. The instructions should be applicable to other systems as well. Information about supported platforms for Qt can be found in http://qt.nokia.com/doc/4.6/supported-platforms.html. Platform specific notes are available at http://doc.trolltech.com/4.6/platform-notes.html. Installation instruction provided by Qt are available at http://qt.nokia.com/doc/4.6/installation.html.
Installation on Windows XP
- Download Qt libraries 4.6 for Windows.
- Download the MinGW compiler in order to compile the QtScriptGenerator (MinGW can be chosen to be downloaded and installed with Qt).
- Execute the Qt installer. The default installation path should be fine. Note that you should install Qt to a directory whose name does not contain whitespaces.
- The installer adds a new folder called Qt SDK by Nokia v2009.05 (open source) to the Start menu. Shortcut called Qt Command Prompt configures environment variables and opens up a new console window.
- Create a new file called make.bat in
(MINGW_DIR)/bin
directory with following lines: - Additional helpful information for MinGW-based installation.
- Support for Secure Sockets Layer (SSL) communication is provided by the OpenSSL Toolkit, which must be obtained separately. Binary distribution for Windows is available at http://www.slproweb.com/products/Win32OpenSSL.html (Win32 OpenSSL v0.9.8l Light).
- The system can also be built using Microsoft Visual Studio 2005 or later. From the Microsoft Visual Studio 2005 Command Prompt, first type
configure
and thennmake
. The configuration step takes about 20-30 minutes, and thenmake
build about 2-3 hours on a typical laptop computer.
@echo off
mingw32-make %*
make
should work.
Installation on Ubuntu Linux 9.10 and Mac OS X
- Download Qt Libraries 4.6 for Linux/X11 or Mac.
- On Linux: at the command line, type:
to run the Setup wizard.
chmod u+x qt-sdk-linux-x86-opensource-2009.05.bin
./qt-sdk-linux-x86-opensource-2009.05.bin
- On Mac OSX: run the installer and follow instructions on the wizard.
- Set QTDIR environment variable to
<path to your installation>/qt
In console, for example:QTDIR=/home/user/qtsdk-2009.05/qt
export QTDIR - You may also want to include path to
(QTDIR)/bin
in part of yourPATH
definition
Installation on Maemo Scratchbox (Nokia N800/N810/N900)
- In order to use the system on Nokia N800/N810/N900, you will need Maemo Scratchbox and the Maemo SDK. To install those, follow the instructions provided at http://wiki.maemo.org/Documentation/Maemo_5_Developer_Guide.
- The SDK is also available as virtual image at http://maemovmware.garage.maemo.org/2nd_edition/index.html.
- When you have a working development environment, follow the instructions at Maemo Wiki for the installation of the Qt platform on Maemo.
Verifying the Qt Installation
A successful Qt build will usually take several hours. If the compilation succeeded without errors, you should verify the installation by running some of the demo applications, and by reviewing the online documentation provided with Qt.
- To run the demo applications, execute the
qtdemo
program provided in directory(QTDIR)/bin
. - To review the online documentation, execute the
assistant
program provided in directory(QTDIR)/bin
.
2. Installing the JavaScript Bindings Using QtScriptGenerator
By default, the JavaScript engine included in the Qt platform does not have access to the Qt APIs. In order to add the JavaScript bindings to the Qt environment, a tool called QtScriptGenerator can be used.
- To begin installation of the JavaScript bindings,
download
QtScriptGenerator. The latest version of the tool is generally recommended. There is a download link provided on the right side of the page (Download master as
tar.gz).
- Unzip the download package, and read the instructions in the README file.
Build QtScriptGenerator as follows (this build process should be nearly identical on all target platforms):
- Open a new shell (in Windows: Qt Command Prompt or Visual Studio 2005 Command Prompt).
- Make sure the
QTDIR
environment variable is defined and points to the root of the Qt installation directory (see the instructions above). Also make sure that(QTDIR)/bin
is part of yourPATH
definition. - Switch to the top-level directory of the QtScriptGenerator.
- In subdirectory
generator
, compile the generator by first invokingqmake
and thenmake
(nmake
if you are using Microsoft Visual Studio). This will take about 1-2 minutes. Note that Qt Script Generator does not compile under Maemo Scratchbox unless it is compiled in thedebug
mode:make debug
- Next, execute the generator by invoking
release/generator
. The generator generates the C++ classes that represent the JavaScript bindings. About 500 C++ classes will be generated in thegenerated_cpp
subdirectory. This step will take about 2-4 minutes. If the generator is not able to detect the header files, you should provide the location of the Qt header files with compilation directive--include-paths
. The necessary include files are generally located in directory(QTDIR)/include
Example:release\generator --include-paths=c:\qt-win\include
- When the generator has generated the required classes,
switch to directory
qtbindings
and executeqmake
and thenmake release
(nmake release
if using Microsoft Visual Studio). This will build the actual JavaScript bindings plugins. This entire step will take about 20-30 minutes.
- In subdirectory
- To verify that the QtScriptGenerator build succeeded, check that you can
find the
qs_eval
executable in directoryqtbindings/qs_eval/release
. QtScriptGenerator includes a set of code files (with file type*.js
) that can be used to test and verify that the environment is functional. The files are located in subdirectory examples. Use theqs_eval
tool to execute some of the sample applications.
Note that the development of QtScriptGenerator is still in progress and that there may
be occasional problems when building the environment. For instance, the OpenGL and
Phonon libraries sometimes fail to build. If that happens, you can exclude those
components from the build by tweaking the qtbindings.pro
file in
subdirectory qtbindings
and then rebuilding the QtScriptGenerator.
3. Running JavaScript Applications and Lively for Qt
- To execute a JavaScript file simply type
qs_eval file.js
qs_eval
to systemPATH
). - To execute the Lively for Qt system, place the files from ZIP file of the Lively for Qt system
in the
release
directory of theqs_eval
tool. The necessary path will look something like:
Then execute the command line included in file".../qtscriptgenerator/qtbindings/qs_eval/release"
Qtly.bat
. - In order to run Lively for Qt without any applications or additional tools, just say:
qs_eval Qtly.js
Notes on Invoking qs_eval
- Note that qs_eval does not display any error messages if the file(s) to be executed cannot be found.
- If you wish to include/execute more than one JavaScript file, you should switch to the directory where those JavaScript files
reside before calling
qs_eval
. Otherwise, the requested files are not necessarily found. - You may want to use command line option
-graphicssystem raster
to speed up drawing operations. - The JavaScript environment inside Qt ("QtScript") is equipped with a built-in debugger that can be extremely useful during
development. The debugger can be opened manually by invoking
"debugger;"
from JavaScript code.
Qt API Documentation
- The Qt JavaScript API documentation generated by QtScriptGenerator can be found in HTML format
under subdirectory
doc
. - The general Qt API documentation can be viewed either by opening
the
(QTDIR)/bin/assistant
tool or by viewing Qt API documentation on the web.
4. Running Lively for Qt Inside a Web Browser
Lively for Qt can be run in any web browser using a Qt web browser plugin. Instructions for installing the necessary web browser plugin(s) will be available here later.