General Installation Information

In order to use Lively for Qt, follow the steps below:

    1. Install the Qt platform on your target computer or device.
    2. Add support for JavaScript bindings to the Qt environment by running the QtScriptGenerator tool.
    3. 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"
    4. 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.


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 8.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://doc.trolltech.com/4.5/supported-platforms.html. Platform specific notes are available at http://doc.trolltech.com/4.5/platform-notes-platforms.html.

Installation on Windows XP

  • Download Qt libraries 4.5 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 the Qt bin directory to the system path and configures other needed environment variables (Qt 4.5.0 Command Prompt can be found in Start menu under Qt by Nokia v.4.5.0 (OpenSource)).
  • Additional helpful information for MinGW-based installation.
  • 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 then nmake. The configuration step takes about 20-30 minutes, and the nmake build about 2-3 hours on a typical laptop computer.

Installation on Ubuntu Linux 8.10 and Mac OS X

  • Download Qt libraries 4.5 for Linux/X11 or Qt libraries 4.5 for Mac
  • Decompress the gzipped tar package in the console:
    tar xvzf qt-x11-opensource-src-4.5.0.tar.gz
  • Switch to the decompressed directory and configure Qt by giving out the command:
    ./configure
    You may add parameters to the configure command; as default Qt is installed under /usr/local/Trolltech/Qt.4.5.0. The list of configuration options can be obtained by
    ./configure help
  • After the configuration has ended, check that the components of Qt are available that you wish to include, i.e. OpenGL, Phonon etc. Those may require further libraries to be installed. The configure program provides an output where all the compilation options are listed and can be easily checked.
  • The actual build is started with command
    make
  • When the build finishes, install Qt by giving out the command
    make install
  • In order to make Qt libraries available in the system, add the Qt bin directory to the system PATH, e.g. add the following entries to the $HOME/.profile file.
    PATH=/usr/local/Trolltech/Qt-4.5.0/bin:$PATH
    export PATH
  • Add also the QTDIR environment variable that points to the installation directory of Qt to the $HOME/.profile file.
  • QTDIR=/usr/local/Trolltech/Qt-4.5.0
    export QTDIR

Installation on Maemo Scratchbox (Nokia N800/N810)

  • In order to use the system on Nokia N800/N810, you will need Maemo Scratchbox and the Maemo SDK. To install those, follow the instructions provided at http://maemo.org/development/sdks/maemo_4-1-2_diablo/.
  • 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.
  • Unzip the download package, and read the instructions in the README file provided with the ZIP 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 your PATH definition.
  • Switch to the top-level directory of the QtScriptGenerator.
    1. In subdirectory generator, compile the generator by first invoking qmake and then make (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 the debug mode:
      make debug
    2. 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 the generated_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
    3. When the generator has generated the required classes, switch to directory qtbindings and execute qmake and then make 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.

  • To verify that the QtScriptGenerator build succeeded, check that you can find the qs_eval executable in directory qtbindings/qs_eval/release. QtScriptGenerator includes a set of code files (with file type *.qs) that can be used to test and verify that the environment is functional. The files are located in subdirectory examples. Use the qs_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.qs
    (it is recommended that you add the directory containing qs_eval to system PATH).
  • To execute the Lively for Qt system, place the files from ZIP file of the Lively for Qt system in the release directory of the qs_eval tool. The necessary path will look something like:
    ".../qtscriptgenerator/qtbindings/qs_eval/release".

    Then execute the command line included in file 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.
  • 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.