/doc/src/platforms/emb-qvfb.qdoc

https://bitbucket.org/ultra_iter/qt-vtl · Unknown · 277 lines · 225 code · 52 blank · 0 comment · 0 complexity · 7dc08043f2eea42b72a690fe93bd4ef5 MD5 · raw file

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