1 | /****************************************************************************
|
---|
2 | **
|
---|
3 | ** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
|
---|
4 | ** All rights reserved.
|
---|
5 | ** Contact: Nokia Corporation (qt-info@nokia.com)
|
---|
6 | **
|
---|
7 | ** This file is part of the documentation of the Qt Toolkit.
|
---|
8 | **
|
---|
9 | ** $QT_BEGIN_LICENSE:FDL$
|
---|
10 | ** Commercial Usage
|
---|
11 | ** Licensees holding valid Qt Commercial licenses may use this file in
|
---|
12 | ** accordance with the Qt Commercial License Agreement provided with the
|
---|
13 | ** Software or, alternatively, in accordance with the terms contained in a
|
---|
14 | ** written agreement between you and Nokia.
|
---|
15 | **
|
---|
16 | ** GNU Free Documentation License
|
---|
17 | ** Alternatively, this file may be used under the terms of the GNU Free
|
---|
18 | ** Documentation License version 1.3 as published by the Free Software
|
---|
19 | ** Foundation and appearing in the file included in the packaging of this
|
---|
20 | ** file.
|
---|
21 | **
|
---|
22 | ** If you have questions regarding the use of this file, please contact
|
---|
23 | ** Nokia at qt-info@nokia.com.
|
---|
24 | ** $QT_END_LICENSE$
|
---|
25 | **
|
---|
26 | ****************************************************************************/
|
---|
27 |
|
---|
28 | /*!
|
---|
29 | \page qvfb.html
|
---|
30 |
|
---|
31 | \title The Virtual Framebuffer
|
---|
32 | \ingroup qt-embedded-linux
|
---|
33 |
|
---|
34 | \l{Qt for Embedded Linux} applications write directly to the
|
---|
35 | framebuffer, eliminating the need for the X Window System and
|
---|
36 | saving memory. For development and debugging purposes, a virtual
|
---|
37 | framebuffer can be used, allowing \l{Qt for Embedded Linux}
|
---|
38 | programs to be developed on a desktop machine, without switching
|
---|
39 | between consoles and X11.
|
---|
40 |
|
---|
41 | QVFb is an X11 application supplied with Qt for X11 that provides
|
---|
42 | a virtual framebuffer for Qt for Embedded Linux to use. To use it,
|
---|
43 | you need to \l{Installing Qt for X11 Platforms}{configure and
|
---|
44 | install Qt for X11 platforms} appropriately. Further requirements
|
---|
45 | can be found in the \l{Qt for Embedded Linux Requirements}
|
---|
46 | document.
|
---|
47 |
|
---|
48 | \image qt-embedded-virtualframebuffer.png
|
---|
49 |
|
---|
50 | The virtual framebuffer emulates a framebuffer using a shared
|
---|
51 | memory region and the \c qvfb tool to display the framebuffer in a
|
---|
52 | window. The \c qvfb tool also supports a feature known as a skin
|
---|
53 | which can be used to change the look and feel of the display. The
|
---|
54 | tool is located in Qt's \c tools/qvfb directory, and provides
|
---|
55 | several additional features accessible through its \gui File and
|
---|
56 | \gui View menus.
|
---|
57 |
|
---|
58 | Please note that the virtual framebuffer is a development tool
|
---|
59 | only. No security issues have been considered in the virtual
|
---|
60 | framebuffer design. It should be avoided in a production
|
---|
61 | environment; i.e. do not configure production libraries with the
|
---|
62 | \c -qvfb option.
|
---|
63 |
|
---|
64 | \tableofcontents
|
---|
65 |
|
---|
66 | \section1 Displaying the Virtual Framebuffer
|
---|
67 |
|
---|
68 | To run the \c qvfb tool displaying the virtual framebuffer, the
|
---|
69 | \l{Qt for Embedded Linux} library must be configured and compiled
|
---|
70 | with the \c -qvfb option:
|
---|
71 |
|
---|
72 | \snippet doc/src/snippets/code/doc_src_emb-qvfb.qdoc 0
|
---|
73 |
|
---|
74 | Ensure that you have all the
|
---|
75 | \l{Qt for Embedded Linux Requirements#Additional X11 Libraries for QVFb}
|
---|
76 | {necessary libraries} needed to build the tool, then compile and run the
|
---|
77 | \c qvfb tool as a normal Qt for X11 application (i.e., do \e not compile
|
---|
78 | it as a \l{Qt for Embedded Linux} application):
|
---|
79 |
|
---|
80 | \snippet doc/src/snippets/code/doc_src_emb-qvfb.qdoc 1
|
---|
81 |
|
---|
82 | The \c qvfb application supports the following command line
|
---|
83 | options:
|
---|
84 |
|
---|
85 | \table
|
---|
86 | \header \o Option \o Description
|
---|
87 | \row
|
---|
88 | \o \c {-width <value>}
|
---|
89 | \o The width of the virtual framebuffer (default: 240).
|
---|
90 | \row
|
---|
91 | \o \c {-height <value>}
|
---|
92 | \o The height of the virtual framebuffer (default: 320).
|
---|
93 | \row
|
---|
94 | \o \c {-depth <value>}
|
---|
95 | \o The depth of the virtual framebuffer (1, 8 or 32; default: 8).
|
---|
96 | \row
|
---|
97 | \o \c -nocursor
|
---|
98 | \o Do not display the X11 cursor in the framebuffer window.
|
---|
99 | \row
|
---|
100 | \o \c {-qwsdisplay <:id>}
|
---|
101 | \o The \l{Qt for Embedded Linux} display ID (default: 0).
|
---|
102 | \row
|
---|
103 | \o \c {-skin <name>.skin}
|
---|
104 | \o The preferred skin. Note that the skin must be located in Qt's
|
---|
105 | \c /tools/qvfb/ directory.
|
---|
106 | \row
|
---|
107 | \o \c {-zoom <factor>}
|
---|
108 | \o Scales the application view with the given factor.
|
---|
109 |
|
---|
110 | \endtable
|
---|
111 |
|
---|
112 | \section2 Skins
|
---|
113 |
|
---|
114 | A skin is a set of XML and pixmap files that tells the vitual
|
---|
115 | framebuffer what it should look like and how it should behave; a
|
---|
116 | skin can change the unrealistic default display into a display
|
---|
117 | that is similar to the target device. To access the \c qvfb tool's
|
---|
118 | menus when a skin is activated, right-click over the display.
|
---|
119 |
|
---|
120 | Note that a skin can have buttons which (when clicked) send
|
---|
121 | signals to the Qt Extended application running inside the virtual
|
---|
122 | framebuffer, just as would happen on a real device.
|
---|
123 |
|
---|
124 | \table 100%
|
---|
125 | \row
|
---|
126 | \o
|
---|
127 | \bold {Target Device Environment}
|
---|
128 |
|
---|
129 | The \c qvfb tool provides various skins by default, allowing
|
---|
130 | the user to view their application in an environment similar
|
---|
131 | to their target device. The provided skins are:
|
---|
132 |
|
---|
133 | \list
|
---|
134 | \o ClamshellPhone
|
---|
135 | \o PortableMedia
|
---|
136 | \o S60-nHD-Touchscreen
|
---|
137 | \o S60-QVGA-Candybar
|
---|
138 | \o SmartPhone
|
---|
139 | \o SmartPhone2
|
---|
140 | \o SmartPhoneWithButtons
|
---|
141 | \o TouchscreenPhone
|
---|
142 | \endlist
|
---|
143 |
|
---|
144 | In addition, it is possible to create custom skins.
|
---|
145 |
|
---|
146 | \o \image qt-embedded-phone.png
|
---|
147 | \o \image qt-embedded-pda.png
|
---|
148 | \endtable
|
---|
149 |
|
---|
150 | \bold {Creating Custom Skins}
|
---|
151 |
|
---|
152 | The XML and pixmap files specifying a custom skin must be located
|
---|
153 | in subdirectory of the Qt's \c /tools/qvfb directory, called \c
|
---|
154 | /customskin.skin. See the ClamshellPhone skin for an example of the
|
---|
155 | file structure:
|
---|
156 |
|
---|
157 | \snippet doc/src/snippets/code/doc_src_emb-qvfb.qdoc 2
|
---|
158 |
|
---|
159 | The \c /ClamshellPhone.skin directory contains the following files:
|
---|
160 |
|
---|
161 | \list
|
---|
162 | \o \c ClamshellPhone.skin
|
---|
163 | \o \c ClamshellPhone1-5.png
|
---|
164 | \o \c ClamshellPhone1-5-pressed.png
|
---|
165 | \o \c ClamshellPhone1-5-closed.png
|
---|
166 | \o \c defaultbuttons.conf (only necessary for \l Qt Extended)
|
---|
167 | \endlist
|
---|
168 |
|
---|
169 | Note that the \c defaultbuttons.conf file is only necessary if the
|
---|
170 | skin is supposed to be used with \l Qt Extended (The file customizes
|
---|
171 | the launch screen applications, orders the soft keys and provides
|
---|
172 | input method hints). See the \l Qt Extended documentation for more
|
---|
173 | information.
|
---|
174 |
|
---|
175 | \table 100%
|
---|
176 | \header
|
---|
177 | \o {3,1} The ClamshellPhone Skin
|
---|
178 | \row
|
---|
179 | \o {3,1}
|
---|
180 |
|
---|
181 | \snippet doc/src/snippets/code/doc_src_emb-qvfb.qdoc 3
|
---|
182 |
|
---|
183 | The \c ClamShellPhone.skin file quoted above, specifies three
|
---|
184 | pixmaps: One for the normal skin (\c Up), one for the activated
|
---|
185 | skin (\c Down) and one for the closed skin (\c Closed). In
|
---|
186 | addition, it is possible to specify a pixmap for the cursor (using
|
---|
187 | a \c Cursor variable).
|
---|
188 |
|
---|
189 | The file also specifies the screen size (\c Screen) and the number
|
---|
190 | of available buttons (\c Areas). Then it describes the buttons
|
---|
191 | themselves; each button is specified by its name, keycode and
|
---|
192 | coordinates.
|
---|
193 |
|
---|
194 | The coordinates are a list of at least 2 points in clockwise order
|
---|
195 | that define a shape for the button; a click inside this shape will
|
---|
196 | be treated as a click on that button. While pressed, the pixels
|
---|
197 | for the button are redrawn from the activated skin.
|
---|
198 |
|
---|
199 | \row
|
---|
200 | \row
|
---|
201 | \o
|
---|
202 | \image qt-embedded-clamshellphone-closed.png The ClamshellPhone Skin (closed)
|
---|
203 | \o
|
---|
204 | \image qt-embedded-clamshellphone.png The ClamshellPhone Skin
|
---|
205 | \o
|
---|
206 | \image qt-embedded-clamshellphone-pressed.png The ClamshellPhone Skin (pressed)
|
---|
207 | \row
|
---|
208 | \o \c ClamshellPhone1-5-closed.png
|
---|
209 | \o \c ClamshellPhone1-5.png
|
---|
210 | \o \c ClamshellPhone1-5-pressed.png
|
---|
211 | \endtable
|
---|
212 |
|
---|
213 | \section2 The File Menu
|
---|
214 |
|
---|
215 | \image qt-embedded-qvfbfilemenu.png
|
---|
216 |
|
---|
217 | The \gui File menu allows the user to configure the virtual
|
---|
218 | framebuffer display (\gui File|Configure...), save a snapshot of
|
---|
219 | the framebuffer contents (\gui {File|Save Image...}) and record
|
---|
220 | the movements in the framebuffer (\gui File|Animation...).
|
---|
221 |
|
---|
222 | When choosing the \gui File|Configure menu item, the \c qvfb tool
|
---|
223 | provides a configuration dialog allowing the user to customize the
|
---|
224 | display of the virtual framebuffer. The user can modify the size
|
---|
225 | and depth as well as the Gamma values, and also select the
|
---|
226 | preferred skin (i.e. making the virtual framebuffer simulate the
|
---|
227 | target device environment). In addition, it is possible to emulate
|
---|
228 | a touch screen and a LCD screen.
|
---|
229 |
|
---|
230 | Note that when configuring (except when changing the Gamma values
|
---|
231 | only), any applications using the virtual framebuffer will be
|
---|
232 | terminated.
|
---|
233 |
|
---|
234 | \section2 The View Menu
|
---|
235 |
|
---|
236 | \image qt-embedded-qvfbviewmenu.png
|
---|
237 |
|
---|
238 | The \gui View menu allows the user to modify the target's refresh
|
---|
239 | rate (\gui {View|Refresh Rate...}), making \c qvfb check for
|
---|
240 | updated regions more or less frequently.
|
---|
241 |
|
---|
242 | The regions of the display that have changed are updated
|
---|
243 | periodically, i.e. the virtual framebuffer is displaying discrete
|
---|
244 | snapshots of the framebuffer rather than each individual drawing
|
---|
245 | operation. For this reason drawing problems such as flickering may
|
---|
246 | not be apparent until the program is run using a real framebuffer.
|
---|
247 | If little drawing is being done, the framebuffer will not show any
|
---|
248 | updates between drawing events. If an application is displaying an
|
---|
249 | animation, the updates will be frequent, and the application and
|
---|
250 | \c qvfb will compete for processor time.
|
---|
251 |
|
---|
252 | The \gui View menu also allows the user to zoom the view of the
|
---|
253 | application (\gui {View|Zoom *}).
|
---|
254 |
|
---|
255 | \section1 Running Applications Using the Virtual Framebuffer
|
---|
256 |
|
---|
257 | Once the virtual framebuffer (the \c qvfb application) is running,
|
---|
258 | it is ready for use: Start a server application (i.e. construct a
|
---|
259 | QApplication object with the QApplication::GuiServer flag or use
|
---|
260 | the \c -qws command line parameter. See the
|
---|
261 | \l {Running Qt for Embedded Linux Applications}{running applications}
|
---|
262 | documentation for details). For example:
|
---|
263 |
|
---|
264 | \snippet doc/src/snippets/code/doc_src_emb-qvfb.qdoc 4
|
---|
265 |
|
---|
266 | Note that as long as the virtual framebuffer is running and the
|
---|
267 | current \l{Qt for Embedded Linux} configuration supports \c qvfb,
|
---|
268 | \l{Qt for Embedded Linux} will automatically detect it and use it by
|
---|
269 | default. Alternatively, the \c -display option can be used to
|
---|
270 | specify the virtual framebuffer driver. For example:
|
---|
271 |
|
---|
272 | \snippet doc/src/snippets/code/doc_src_emb-qvfb.qdoc 5
|
---|
273 |
|
---|
274 | \warning If \c qvfb is not running (or the current
|
---|
275 | \l{Qt for Embedded Linux} configuration doesn't support it) and the
|
---|
276 | driver is not explicitly specified, \l{Qt for Embedded Linux} will
|
---|
277 | write to the real framebuffer and the X11 display will be corrupted.
|
---|
278 | */
|
---|