Qt Reference Documentation

- Qt 4.8
- ALL VERSIONS

- A
- A
- A
- Print

# The VNC Protocol and Qt for Embedded Linux

VNC (Virtual Network Computing) software makes it possible to view and interact with one computer (the "server") from any other computer or mobile device (the "viewer") anywhere on a network.

VNC clients are available for a vast array of display systems, including X11, Mac OS X and Windows.

## Configuring Qt with VNC Capabilities

To run a Qt for Embedded Linux application using the VNC protocol, the Qt for Embedded Linux library must be configured and compiled with the `-qt-gfx-vnc` option:

     cd path/to/QtEmbedded
     ./configure -qt-gfx-vnc
     make

## Running a Server Application

Start a server application by specifying the `-qws` command line option when running the application. (This can also be specified in the application's source code.) Use the `-display` command line option to specify the VNC server's driver and the virtual screen to use. For example:

     cd path/to/QtEmbedded/examples/widgets/analogclock
     ./analogclock -qws -display VNC:0

The application will act as a VNC server which can be accessed using an ordinary VNC client, either on the development machine or from a different machine on a network.

For example, using the X11 VNC client to view the application from the same machine:

     vncviewer localhost:0

To interact with the application from another machine on the network, run a VNC client pointing to the machine that is running the server application.

Qt for Embedded Linux will create a 640 by 480 pixel display by default. Alternatively, the `QWS_SIZE` environment variable can be used to set another size; e.g., `QWS_SIZE=240x320`.

## Running Client Applications

If you want to run more than one application on the same display, you only need to start the first one as a server application, using the `-qws` command line option to indicate that it will manage other windows.

     analogclock -qws -display VNC:0

Subsequent client applications can be started without the `-qws` option, but will each require the same `-display` option and argument as those used for the server.

     calculator -display VNC:0
     scribble -display VNC:0
     imageviewer -display VNC:0

However, for the clients, this option will not cause a new VNC server to be started, but only indicates that their windows will appear on the virtual screen managed by the server application.

## Related Resources

It is not always necessary to specify the `-qws` command line option when running a server application as long as the QApplication object used by the application has been constructed with the QApplication::GuiServer flag.

See the running applications documentation for more details about server and client applications.

The Virtual Framebuffer The virtual framebuffer is an alternative technique recommended for development and debugging purposes. The virtual framebuffer emulates a framebuffer using a shared memory region and the `qvfb` tool to display the framebuffer in a window.

Its use of shared memory makes the virtual framebuffer much faster and smoother than using the VNC protocol, but it does not operate over a network.