|  | Home · All Classes · Main Classes · Grouped Classes · Modules · Functions |

# Running Qtopia Core Applications

A Qtopia Core application requires a master application to be running, or to be the master application itself. The master application is primarily responsible for managing top-level window regions, and pointer and keyboard input.

Any Qtopia Core application can be the master application by constructing the QApplication object with the `QApplication::GuiServer` type, or by being run with the `-qws` command line option.

This document assumes you have the Linux framebuffer configured correctly and that no master process is running. If you do not have a working Linux framebuffer you can use the Qtopia Core virtual framebuffer, or you can run Qtopia Core as a VNC server.

Change to a Linux console and select an example to run, e.g. `examples/widgets`. Make sure `$QTDIR` is set to the directory where you installed Qtopia Core and add the `$QTDIR/lib` directory to `$LD_LIBRARY_PATH`, e.g.:

        export QTDIR=$HOME/qt-VERSION
        export LD_LIBRARY_PATH=$QTDIR/lib:$LD_LIBRARY_PATH

Run the application with the `-qws` option:

        cd $QTDIR/examples/demos/textedit
        ./textedit -qws

You should see the `textedit` example appear. If your mouse doesn't work correctly you must specify the type of mouse to use. You can exit the master application at any time using Ctrl+Alt+Backspace.

If you wish to run additional applications you should run them as clients i.e. without the `-qws` option.

## Displays

Qtopia Core allows multiple displays to be used simultaneously by running multiple Qtopia Core master processes. This is achieved using the `-display` command line parameter or the `$QWS_DISPLAY` environment variable.

The `-display` parameter's syntax is:

        [gfx driver][:driver specific options][:display number]

To try this functionality you can do the following:

1. Change to VC 1 (virtual console one) and run the launcher example:

           $ cd examples/tools/launcher
           $ ./launcher -qws

2. Switch to VC 2 and run another one:

           $ cd examples/tools/launcher
           $ ./launcher -qws -display :1

   Another launcher will be started. Start an application in this launcher.

3. Press Ctrl+Alt+F1 - back to display 0. You can also start additional applications on a particular display by specifying the display ID. Change to VC 3:

           $ cd examples/widgets/styles
           $ ./styles -display :1

   will display the widgets example on display :1 (VC 2).

Only the master process needs to specify the driver/device part explicitly. The clients get the information they need from the master when they connect. So once you have a master server running using a particular driver, you can just use `client` `display` `n` to use display `n`.

## Mouse Input

Qtopia Core attempts to autodetect a mouse by default. The supported protocols are MouseMan, Microsoft, IntelliMouse and some other devices specific to certain hardware (e.g. Vr touch panel). To specify the mouse to use set the `$QWS_MOUSE_PROTO` environment variable, for example:

        export QWS_MOUSE_PROTO=IntelliMouse

The mouse autodetection opens the serial devices and psaux which may cause conflicts with other programs using those devices. If this is the case then specify the mouse driver protocol and device explicitly:

        export QWS_MOUSE_PROTO=MouseMan:/dev/inputs/mice

See also Qtopia Core Pointer Handling.