Controlled by Qt Extended
This is the preferred method of controlling a secondary display. This display is available as a framebuffer device and managed by the Qt Extended multiple display support. This allows any Qt Extended application to display windows on the secondary display. Support for a secondary display of this type is already built into Qt Extended and will be enabled if more than one display is specified.
The display configuration is specified to Qt Extended by the QWS_DISPLAY environment variable. The multi display driver presents multiple display devices to Qt Extended as one large display. The QDesktopWidget class may be used to access the display properties.
Consider the following screen configuration:
- /dev/fb0 - primary 240x320 display
- /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 Qt Extended 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 The Virtual Framebuffer documentation.
The secondary display support provided by Qt Extended 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, Qt Extended 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 Qt Extended 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:
- using one Qt for Embedded Linux display -
the status display will appear as a floating display in the Qt Extended display. This is the common case for a LCD display which does not need the complete Qt for Embedded Linux graphics engine to drive it. To view in this mode, simply run the application.
- 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