<?xml version="1.0" encoding="iso-8859-1"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <!-- emb-vnc.qdoc --> <head> <title>Qt 4.6: The VNC Protocol and Qt for Embedded Linux</title> <link href="classic.css" rel="stylesheet" type="text/css" /> </head> <body> <table border="0" cellpadding="0" cellspacing="0" width="100%"> <tr> <td align="left" valign="top" width="32"><a href="http://qt.nokia.com/"><img src="images/qt-logo.png" align="left" border="0" /></a></td> <td width="1"> </td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a> · <a href="classes.html"><font color="#004faf">All Classes</font></a> · <a href="functions.html"><font color="#004faf">All Functions</font></a> · <a href="overviews.html"><font color="#004faf">Overviews</font></a></td></tr></table><h1 class="title">The VNC Protocol and Qt for Embedded Linux<br /><span class="subtitle"></span> </h1> <p>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.</p> <p align="center"><img src="images/qt-embedded-vnc-screen.png" /></p><p>VNC clients are available for a vast array of display systems, including X11, Mac OS X and Windows.</p> <a name="configuring-qt-with-vnc-capabilities"></a> <h3>Configuring Qt with VNC Capabilities</h3> <p>To run a <a href="qt-embedded-linux.html">Qt for Embedded Linux</a> application using the VNC protocol, the <a href="qt-embedded-linux.html">Qt for Embedded Linux</a> library must be configured and compiled with the <tt>-qt-gfx-vnc</tt> option:</p> <pre> cd path/to/QtEmbedded ./configure -qt-gfx-vnc make</pre> <a name="running-a-server-application"></a> <h3>Running a Server Application</h3> <p>Start a server application by specifying the <tt>-qws</tt> command line option when running the application. (This can also be specified in the application's source code.) Use the <tt>-display</tt> command line option to specify the VNC server's driver and the virtual screen to use. For example:</p> <pre> cd path/to/QtEmbedded/examples/widgets/analogclock ./analogclock -qws -display VNC:0</pre> <p>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.</p> <p>For example, using the X11 VNC client to view the application from the same machine:</p> <pre> vncviewer localhost:0</pre> <p>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.</p> <p><a href="qt-embedded-linux.html">Qt for Embedded Linux</a> will create a 640 by 480 pixel display by default. Alternatively, the <tt>QWS_SIZE</tt> environment variable can be used to set another size; e.g., <tt>QWS_SIZE=240x320</tt>.</p> <a name="running-client-applications"></a> <h3>Running Client Applications</h3> <p>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 <tt>-qws</tt> command line option to indicate that it will manage other windows.</p> <pre> analogclock -qws -display VNC:0</pre> <p>Subsequent client applications can be started <i>without</i> the <tt>-qws</tt> option, but will each require the same <tt>-display</tt> option and argument as those used for the server.</p> <pre> calculator -display VNC:0 scribble -display VNC:0 imageviewer -display VNC:0</pre> <p>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.</p> <a name="related-resources"></a> <h3>Related Resources</h3> <p>It is not always necessary to specify the <tt>-qws</tt> command line option when running a server application as long as the <a href="qapplication.html">QApplication</a> object used by the application has been constructed with the <a href="qapplication.html#Type-enum">QApplication::GuiServer</a> flag.</p> <p>See the <a href="qt-embedded-running.html">running applications</a> documentation for more details about server and client applications.</p> <p><table class="generic" align="center" cellpadding="2" cellspacing="1" border="0"> <tr valign="top" class="odd"><td><b>The Virtual Framebuffer</b><p>The <a href="qvfb.html">virtual framebuffer</a> is an alternative technique recommended for development and debugging purposes.</p> <p>The virtual framebuffer emulates a framebuffer using a shared memory region and the <tt>qvfb</tt> tool to display the framebuffer in a window.</p> <p>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.</p> </td><td><img src="images/qt-embedded-virtualframebuffer.png" /></td></tr> </table></p> <p /><address><hr /><div align="center"> <table width="100%" cellspacing="0" border="0"><tr class="address"> <td width="40%" align="left">Copyright © 2010 Nokia Corporation and/or its subsidiary(-ies)</td> <td width="20%" align="center"><a href="trademarks.html">Trademarks</a></td> <td width="40%" align="right"><div align="right">Qt 4.6.3</div></td> </tr></table></div></address></body> </html>