<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en_US" lang="en_US"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <!-- emb-vnc.qdoc --> <title>Qt 4.8: The VNC Protocol and Qt for Embedded Linux</title> <link rel="stylesheet" type="text/css" href="style/style.css" /> <script src="scripts/jquery.js" type="text/javascript"></script> <script src="scripts/functions.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="style/superfish.css" /> <link rel="stylesheet" type="text/css" href="style/narrow.css" /> <!--[if IE]> <meta name="MSSmartTagsPreventParsing" content="true"> <meta http-equiv="imagetoolbar" content="no"> <![endif]--> <!--[if lt IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie6.css"> <![endif]--> <!--[if IE 7]> <link rel="stylesheet" type="text/css" href="style/style_ie7.css"> <![endif]--> <!--[if IE 8]> <link rel="stylesheet" type="text/css" href="style/style_ie8.css"> <![endif]--> <script src="scripts/superfish.js" type="text/javascript"></script> <script src="scripts/narrow.js" type="text/javascript"></script> </head> <body class="" onload="CheckEmptyAndLoadList();"> <div class="header" id="qtdocheader"> <div class="content"> <div id="nav-logo"> <a href="index.html">Home</a></div> <a href="index.html" class="qtref"><span>Qt Reference Documentation</span></a> <div id="narrowsearch"></div> <div id="nav-topright"> <ul> <li class="nav-topright-home"><a href="http://qt.digia.com/">Qt HOME</a></li> <li class="nav-topright-dev"><a href="http://qt-project.org/">DEV</a></li> <li class="nav-topright-doc nav-topright-doc-active"><a href="http://qt-project.org/doc/"> DOC</a></li> <li class="nav-topright-blog"><a href="http://blog.qt.digia.com/">BLOG</a></li> </ul> </div> <div id="shortCut"> <ul> <li class="shortCut-topleft-inactive"><span><a href="index.html">Qt 4.8</a></span></li> <li class="shortCut-topleft-active"><a href="http://qt-project.org/doc/">ALL VERSIONS </a></li> </ul> </div> <ul class="sf-menu" id="narrowmenu"> <li><a href="#">API Lookup</a> <ul> <li><a href="classes.html">Class index</a></li> <li><a href="functions.html">Function index</a></li> <li><a href="modules.html">Modules</a></li> <li><a href="namespaces.html">Namespaces</a></li> <li><a href="qtglobal.html">Global Declarations</a></li> <li><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </li> <li><a href="#">Qt Topics</a> <ul> <li><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li><a href="supported-platforms.html">Supported Platforms</a></li> <li><a href="technology-apis.html">Qt and Key Technologies</a></li> <li><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </li> <li><a href="#">Examples</a> <ul> <li><a href="all-examples.html">Examples</a></li> <li><a href="tutorials.html">Tutorials</a></li> <li><a href="demos.html">Demos</a></li> <li><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </li> </ul> </div> </div> <div class="wrapper"> <div class="hd"> <span></span> </div> <div class="bd group"> <div class="sidebar"> <div class="searchlabel"> Search index:</div> <div class="search" id="sidebarsearch"> <form id="qtdocsearch" action="" onsubmit="return false;"> <fieldset> <input type="text" name="searchstring" id="pageType" value="" /> <div id="resultdialog"> <a href="#" id="resultclose">Close</a> <p id="resultlinks" class="all"><a href="#" id="showallresults">All</a> | <a href="#" id="showapiresults">API</a> | <a href="#" id="showarticleresults">Articles</a> | <a href="#" id="showexampleresults">Examples</a></p> <p id="searchcount" class="all"><span id="resultcount"></span><span id="apicount"></span><span id="articlecount"></span><span id="examplecount"></span> results:</p> <ul id="resultlist" class="all"> </ul> </div> </fieldset> </form> </div> <div class="box first bottombar" id="lookup"> <h2 title="API Lookup"><span></span> API Lookup</h2> <div id="list001" class="list"> <ul id="ul001" > <li class="defaultLink"><a href="classes.html">Class index</a></li> <li class="defaultLink"><a href="functions.html">Function index</a></li> <li class="defaultLink"><a href="modules.html">Modules</a></li> <li class="defaultLink"><a href="namespaces.html">Namespaces</a></li> <li class="defaultLink"><a href="qtglobal.html">Global Declarations</a></li> <li class="defaultLink"><a href="qdeclarativeelements.html">QML elements</a></li> </ul> </div> </div> <div class="box bottombar" id="topics"> <h2 title="Qt Topics"><span></span> Qt Topics</h2> <div id="list002" class="list"> <ul id="ul002" > <li class="defaultLink"><a href="qt-basic-concepts.html">Programming with Qt</a></li> <li class="defaultLink"><a href="qtquick.html">Device UIs & Qt Quick</a></li> <li class="defaultLink"><a href="qt-gui-concepts.html">UI Design with Qt</a></li> <li class="defaultLink"><a href="supported-platforms.html">Supported Platforms</a></li> <li class="defaultLink"><a href="technology-apis.html">Qt and Key Technologies</a></li> <li class="defaultLink"><a href="best-practices.html">How-To's and Best Practices</a></li> </ul> </div> </div> <div class="box" id="examples"> <h2 title="Examples"><span></span> Examples</h2> <div id="list003" class="list"> <ul id="ul003"> <li class="defaultLink"><a href="all-examples.html">Examples</a></li> <li class="defaultLink"><a href="tutorials.html">Tutorials</a></li> <li class="defaultLink"><a href="demos.html">Demos</a></li> <li class="defaultLink"><a href="qdeclarativeexamples.html">QML Examples</a></li> </ul> </div> </div> </div> <div class="wrap"> <div class="toolbar"> <div class="breadcrumb toolblock"> <ul> <li class="first"><a href="index.html">Home</a></li> <!-- Breadcrumbs go here --> <li>The VNC Protocol and Qt for Embedded Linux</li> </ul> </div> <div class="toolbuttons toolblock"> <ul> <li id="smallA" class="t_button">A</li> <li id="medA" class="t_button active">A</li> <li id="bigA" class="t_button">A</li> <li id="print" class="t_button"><a href="javascript:this.print();"> <span>Print</span></a></li> </ul> </div> </div> <div class="content mainContent"> <div class="toc"> <h3><a name="toc">Contents</a></h3> <ul> <li class="level1"><a href="#configuring-qt-with-vnc-capabilities">Configuring Qt with VNC Capabilities</a></li> <li class="level1"><a href="#running-a-server-application">Running a Server Application</a></li> <li class="level1"><a href="#running-client-applications">Running Client Applications</a></li> <li class="level1"><a href="#related-resources">Related Resources</a></li> </ul> </div> <h1 class="title">The VNC Protocol and Qt for Embedded Linux</h1> <span class="subtitle"></span> <!-- $$$qt-embedded-vnc.html-description --> <div class="descr"> <a name="details"></a> <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 class="centerAlign"><img src="images/qt-embedded-vnc-screen.png" alt="" /></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> <h2>Configuring Qt with VNC Capabilities</h2> <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 class="cpp"> cd path/to/QtEmbedded ./configure -qt-gfx-vnc make</pre> <a name="running-a-server-application"></a> <h2>Running a Server Application</h2> <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 class="cpp"> 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 class="cpp"> 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> <h2>Running Client Applications</h2> <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 class="cpp"> 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 class="cpp"> 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> <h2>Related Resources</h2> <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> <table class="generic"> <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" alt="" /></td></tr> </table> </div> <!-- @@@qt-embedded-vnc.html --> </div> </div> </div> <div class="ft"> <span></span> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2015 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners.</p> <br /> <p> The documentation provided herein is licensed under the terms of the <a href="http://www.gnu.org/licenses/fdl.html">GNU Free Documentation License version 1.3</a> as published by the Free Software Foundation.</p> <p> Documentation sources may be obtained from <a href="http://www.qt-project.org"> www.qt-project.org</a>.</p> <br /> <p> Qt and respective logos are trademarks of The Qt Company Ltd in Finland and/or other countries worldwide. All other trademarks are property of their respective owners. <a title="Privacy Policy" href="http://en.gitorious.org/privacy_policy/">Privacy Policy</a></p> </div> <script src="scripts/functions.js" type="text/javascript"></script> </body> </html>