Home · All Classes · Grouped Classes · Annotated · Functions

Tutorial: Dual Screen Display

Qtopia provides two possibilities for controlling a secondary display:

  1. Secondary display as a framebuffer, controlled by Qtopia.
  2. Secondary display controlled independantly of Qtopia.

Controlled by Qtopia

This is the preferred method of controlling a secondary display. This display is available as a framebuffer device and managed by Qtopia's multiple display support. This allows any Qtopia application to display windows on the secondary display. Support for a secondary display of this type is already built into Qtopia and will be enabled if more than one display is specified.

The display configuration is specified to Qtopia by the QWS_DISPLAY environment variable. The multi display driver presents multiple display devices to Qtopia as one large display. The QDesktopWidget class may be used to access the display properties.

Consider the following screen configuration:

  1. /dev/fb0 - primary 240x320 display
  2. /dev/fb1 - secondary 96x80 display

We will create a virtual layout with the secondary display positioned directly below the primary display. The positioning of the primary display should always be at 0,0 (the default). The secondary display can be positioned anywhere around the primary display, provided it is not overlapping. For the above configuration QWS_DISPLAY will be defined as:

    QWS_DISPLAY="multi: LinuxFb:/dev/fb0:0 LinuxFb:/dev/fb1:offset=0,320:1 :0"

The multi display driver accepts a space delimited list of drivers. The first parameter specifies the primary display, attached to /dev/fb0. The second parameter specifies the secondary display, attached to /dev/fb1 and positioned directly below the primary display (at 0, 320).

If it required to test Qtopia in the virtual framebuffer (using the same resolution as above) the following QWS_DISPLAY configuration can be used:

    QWS_DISPLAY="multi: QVFb:mmWidth34:mmHeight44:0 QVFb:offset=0,320:1 :0"

Note that two QVFb instances have to be started for this use case. For more details on how to setup and configure see Qtopia Core's Virtual Framebuffer documentation.

The secondary display support provided by Qtopia Phone uses themes to specify the title and homescreen of the secondary display, similar to the title and homescreen of the primary screen. These are specified by secondarytitle.xml and secondaryhome.xml in the $QPEDIR/etc/themes/ directories and are able to display the same data as the primary title and homescreen.

Besides the homescreen and title, Qtopia provides callscreen and camera integration on the secondary display. It is also possible for any application to display a widget on the secondary display simply by positioning a top level window in the secondary display logical area, for example:

    if (QApplication::desktop()->numScreens() > 1) {
        QLabel *label = new QLabel("Hello");
        label->setGeometry(QApplication::desktop()->availableGeometry(1));
        label->showMaximized();
    }

Controlled Independantly

If the secondary display is not exposed as a framebuffer device, or Qtopia multiple display support is not being used, the QPhoneStatus class is available to enable easy access to phone status information for custom secondary status display.

Example Dual Screen Application

There is an example of a simple status display for a dual screen phone in examples/dualdisplaybasic. It illustrates the use of the phone status library and provides a small display, similar to a monochrome LCD display to display the state of the phone.

There are two options for display:

  1. using one Qtopia Core display -

    the status display will appear as a floating display in the Qtopia display. This is the common case for a LCD display which does not need the complete Qtopia Core graphics engine to drive it. To view in this mode, simply run the application.

  2. using a separate display -

    the status display appears in a separate framebuffer. This case is desirable on a larger, full color secondary display. To view the example in this mode create a separate framebuffer and start the application in this framebuffer.

    For example:

        qvfb -width 83 -height 46 -qwsdisplay :2
        ./dualdisplaybasic -qws -display :2


Copyright © 2008 Nokia Trademarks
Qtopia 4.3.3