<?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" /> <!-- qmouse_qws.cpp --> <title>Qt 4.8: QWSMouseHandler Class Reference</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><a href="modules.html">Modules</a></li> <li><a href="qtgui.html">QtGui</a></li> <li>QWSMouseHandler</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="#public-functions">Public Functions</a></li> <li class="level1"><a href="#details">Detailed Description</a></li> </ul> </div> <h1 class="title">QWSMouseHandler Class Reference</h1> <!-- $$$QWSMouseHandler-brief --> <p>The QWSMouseHandler class is a base class for mouse drivers in Qt for Embedded Linux. <a href="#details">More...</a></p> <!-- @@@QWSMouseHandler --> <pre class="cpp"> <span class="preprocessor">#include <QWSMouseHandler></span></pre><p><b>Inherited by: </b><a href="qwscalibratedmousehandler.html">QWSCalibratedMouseHandler</a>.</p> <ul> <li><a href="qwsmousehandler-members.html">List of all members, including inherited members</a></li> </ul> <a name="public-functions"></a> <h2>Public Functions</h2> <table class="alignedsummary"> <tr><td class="memItemLeft rightAlign topAlign"> </td><td class="memItemRight bottomAlign"><b><a href="qwsmousehandler.html#QWSMouseHandler">QWSMouseHandler</a></b> ( const QString & <i>driver</i> = QString(), const QString & <i>device</i> = QString() )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual </td><td class="memItemRight bottomAlign"><b><a href="qwsmousehandler.html#dtor.QWSMouseHandler">~QWSMouseHandler</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qwsmousehandler.html#calibrate">calibrate</a></b> ( const QWSPointerCalibrationData * <i>data</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qwsmousehandler.html#clearCalibration">clearCalibration</a></b> ()</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qwsmousehandler.html#getCalibration">getCalibration</a></b> ( QWSPointerCalibrationData * <i>data</i> ) const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwsmousehandler.html#limitToScreen">limitToScreen</a></b> ( QPoint & <i>position</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwsmousehandler.html#mouseChanged">mouseChanged</a></b> ( const QPoint & <i>position</i>, int <i>state</i>, int <i>wheel</i> = 0 )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> const QPoint & </td><td class="memItemRight bottomAlign"><b><a href="qwsmousehandler.html#pos">pos</a></b> () const</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qwsmousehandler.html#resume">resume</a></b> () = 0</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> void </td><td class="memItemRight bottomAlign"><b><a href="qwsmousehandler.html#setScreen">setScreen</a></b> ( const QScreen * <i>screen</i> )</td></tr> <tr><td class="memItemLeft rightAlign topAlign"> virtual void </td><td class="memItemRight bottomAlign"><b><a href="qwsmousehandler.html#suspend">suspend</a></b> () = 0</td></tr> </table> <a name="details"></a> <!-- $$$QWSMouseHandler-description --> <div class="descr"> <h2>Detailed Description</h2> <p>The QWSMouseHandler class is a base class for mouse drivers in Qt for Embedded Linux.</p> <p>Note that this class is only available in <a href="qt-embedded-linux.html">Qt for Embedded Linux</a>.</p> <p><a href="qt-embedded-linux.html">Qt for Embedded Linux</a> provides ready-made drivers for several mouse protocols, see the <a href="qt-embedded-pointer.html">pointer handling</a> documentation for details. Custom mouse drivers can be implemented by subclassing the QWSMouseHandler class and creating a mouse driver plugin (derived from <a href="qmousedriverplugin.html">QMouseDriverPlugin</a>). The default implementation of the <a href="qmousedriverfactory.html">QMouseDriverFactory</a> class will automatically detect the plugin, and load the driver into the server application at run-time using Qt's <a href="plugins-howto.html">plugin system</a>.</p> <p>The mouse driver receives mouse events from the system device and encapsulates each event with an instance of the <a href="qwsevent.html">QWSEvent</a> class which it then passes to the server application (the server is responsible for propagating the event to the appropriate client). To receive mouse events, a QWSMouseHandler object will usually create a <a href="qsocketnotifier.html">QSocketNotifier</a> object for the given device. The <a href="qsocketnotifier.html">QSocketNotifier</a> class provides support for monitoring activity on a file descriptor. When the socket notifier receives data, it will call the mouse driver's <a href="qwsmousehandler.html#mouseChanged">mouseChanged</a>() function to send the event to the <a href="qt-embedded-linux.html">Qt for Embedded Linux</a> server application for relaying to clients.</p> <p>If you are creating a driver for a device that needs calibration or noise reduction, such as a touchscreen, use the <a href="qwscalibratedmousehandler.html">QWSCalibratedMouseHandler</a> subclass instead to take advantage of the <a href="qwsmousehandler.html#calibrate">calibrate</a>() and <a href="qwsmousehandler.html#clearCalibration">clearCalibration</a>() functions. The <a href="qws-mousecalibration.html">Mouse Calibration</a> demonstrates how to write a simple program using the mechanisms provided by the QWSMouseHandler class to calibrate a mouse driver.</p> <p>Note that when deriving from the QWSMouseHandler class, the <a href="qwsmousehandler.html#resume">resume</a>() and <a href="qwsmousehandler.html#suspend">suspend</a>() functions must be reimplemented to control the flow of mouse input, i.e., the default implementation does nothing. Reimplementations of these functions typically call the <a href="qsocketnotifier.html#setEnabled">QSocketNotifier::setEnabled</a>() function to enable or disable the socket notifier, respectively.</p> <p>In addition, QWSMouseHandler provides the <a href="qwsmousehandler.html#setScreen">setScreen</a>() function that allows you to specify a screen for your mouse driver and the <a href="qwsmousehandler.html#limitToScreen">limitToScreen</a>() function that ensures that a given position is within this screen's boundaries (changing the position if necessary). Finally, QWSMouseHandler provides the <a href="qwsmousehandler.html#pos">pos</a>() function returning the current mouse position.</p> </div> <p><b>See also </b><a href="qmousedriverplugin.html">QMouseDriverPlugin</a>, <a href="qmousedriverfactory.html">QMouseDriverFactory</a>, and <a href="qt-embedded-pointer.html">Qt for Embedded Linux Pointer Handling</a>.</p> <!-- @@@QWSMouseHandler --> <div class="func"> <h2>Member Function Documentation</h2> <!-- $$$QWSMouseHandler[overload1]$$$QWSMouseHandlerconstQString&constQString& --> <h3 class="fn"><a name="QWSMouseHandler"></a>QWSMouseHandler::<span class="name">QWSMouseHandler</span> ( const <span class="type"><a href="qstring.html">QString</a></span> & <i>driver</i> = QString(), const <span class="type"><a href="qstring.html">QString</a></span> & <i>device</i> = QString() )</h3> <p>Constructs a mouse driver. The <i>driver</i> and <i>device</i> arguments are passed by the <a href="qt-embedded-envvars.html#qws-mouse-proto">QWS_MOUSE_PROTO</a> environment variable.</p> <p>Call the <a href="qwsserver.html#setMouseHandler">QWSServer::setMouseHandler</a>() function to make the newly created mouse driver, the primary driver. Note that the primary driver is controlled by the system, i.e., the system will delete it upon exit.</p> <!-- @@@QWSMouseHandler --> <!-- $$$~QWSMouseHandler[overload1]$$$~QWSMouseHandler --> <h3 class="fn"><a name="dtor.QWSMouseHandler"></a>QWSMouseHandler::<span class="name">~QWSMouseHandler</span> ()<tt> [virtual]</tt></h3> <p>Destroys this mouse driver.</p> <p>Do not call this function if this driver is the primary mouse driver, i.e., if <a href="qwsserver.html#setMouseHandler">QWSServer::setMouseHandler</a>() function has been called passing this driver as argument. The primary mouse driver is deleted by the system.</p> <!-- @@@~QWSMouseHandler --> <!-- $$$calibrate[overload1]$$$calibrateconstQWSPointerCalibrationData* --> <h3 class="fn"><a name="calibrate"></a><span class="type">void</span> QWSMouseHandler::<span class="name">calibrate</span> ( const <span class="type"><a href="qwspointercalibrationdata.html">QWSPointerCalibrationData</a></span> * <i>data</i> )<tt> [virtual]</tt></h3> <p>This virtual function allows subclasses of <a href="qwsmousehandler.html">QWSMouseHandler</a> to set the calibration information passed in the given <i>data</i>. Note that the default implementation does nothing.</p> <p><b>See also </b><a href="qwscalibratedmousehandler.html#calibrate">QWSCalibratedMouseHandler::calibrate</a>() and <a href="qwsmousehandler.html#clearCalibration">clearCalibration</a>().</p> <!-- @@@calibrate --> <!-- $$$clearCalibration[overload1]$$$clearCalibration --> <h3 class="fn"><a name="clearCalibration"></a><span class="type">void</span> QWSMouseHandler::<span class="name">clearCalibration</span> ()<tt> [virtual]</tt></h3> <p>This virtual function allows subclasses of <a href="qwsmousehandler.html">QWSMouseHandler</a> to clear the calibration information. Note that the default implementation does nothing.</p> <p><b>See also </b><a href="qwscalibratedmousehandler.html#clearCalibration">QWSCalibratedMouseHandler::clearCalibration</a>() and <a href="qwsmousehandler.html#calibrate">calibrate</a>().</p> <!-- @@@clearCalibration --> <!-- $$$getCalibration[overload1]$$$getCalibrationQWSPointerCalibrationData* --> <h3 class="fn"><a name="getCalibration"></a><span class="type">void</span> QWSMouseHandler::<span class="name">getCalibration</span> ( <span class="type"><a href="qwspointercalibrationdata.html">QWSPointerCalibrationData</a></span> * <i>data</i> ) const<tt> [virtual]</tt></h3> <p>This virtual function allows subclasses of <a href="qwsmousehandler.html">QWSMouseHandler</a> to fill in the device coordinates in <i>data</i> with values that correspond to screen coordinates that are already in <i>data</i>. Note that the default implementation does nothing.</p> <!-- @@@getCalibration --> <!-- $$$limitToScreen[overload1]$$$limitToScreenQPoint& --> <h3 class="fn"><a name="limitToScreen"></a><span class="type">void</span> QWSMouseHandler::<span class="name">limitToScreen</span> ( <span class="type"><a href="qpoint.html">QPoint</a></span> & <i>position</i> )</h3> <p>Ensures that the given <i>position</i> is within the screen's boundaries, changing the <i>position</i> if necessary.</p> <p><b>See also </b><a href="qwsmousehandler.html#pos">pos</a>() and <a href="qwsmousehandler.html#setScreen">setScreen</a>().</p> <!-- @@@limitToScreen --> <!-- $$$mouseChanged[overload1]$$$mouseChangedconstQPoint&intint --> <h3 class="fn"><a name="mouseChanged"></a><span class="type">void</span> QWSMouseHandler::<span class="name">mouseChanged</span> ( const <span class="type"><a href="qpoint.html">QPoint</a></span> & <i>position</i>, <span class="type">int</span> <i>state</i>, <span class="type">int</span> <i>wheel</i> = 0 )</h3> <p>Notifies the system of a new mouse event.</p> <p>This function updates the current mouse position and sends the event to the <a href="qt-embedded-linux.html">Qt for Embedded Linux</a> server application for delivery to the correct widget. Note that a custom mouse driver must call this function whenever it wants to deliver a new mouse event.</p> <p>The given <i>position</i> is the global position of the mouse cursor. The <i>state</i> parameter is a bitmask of the <a href="qt.html#MouseButton-enum">Qt::MouseButton</a> enum's values, indicating which mouse buttons are pressed. The <i>wheel</i> parameter is the delta value of the mouse wheel as returned by <a href="qwheelevent.html#delta">QWheelEvent::delta</a>().</p> <p><b>See also </b><a href="qwsmousehandler.html#pos">pos</a>().</p> <!-- @@@mouseChanged --> <!-- $$$pos[overload1]$$$pos --> <h3 class="fn"><a name="pos"></a>const <span class="type"><a href="qpoint.html">QPoint</a></span> & QWSMouseHandler::<span class="name">pos</span> () const</h3> <p>Returns the current mouse position.</p> <p><b>See also </b><a href="qwsmousehandler.html#mouseChanged">mouseChanged</a>() and <a href="qwsmousehandler.html#limitToScreen">limitToScreen</a>().</p> <!-- @@@pos --> <!-- $$$resume[overload1]$$$resume --> <h3 class="fn"><a name="resume"></a><span class="type">void</span> QWSMouseHandler::<span class="name">resume</span> ()<tt> [pure virtual]</tt></h3> <p>Implement this function to resume reading and handling mouse events, e.g., call the <a href="qsocketnotifier.html#setEnabled">QSocketNotifier::setEnabled</a>() function to enable the socket notifier.</p> <p><b>See also </b><a href="qwsmousehandler.html#suspend">suspend</a>().</p> <!-- @@@resume --> <!-- $$$setScreen[overload1]$$$setScreenconstQScreen* --> <h3 class="fn"><a name="setScreen"></a><span class="type">void</span> QWSMouseHandler::<span class="name">setScreen</span> ( const <span class="type"><a href="qscreen.html">QScreen</a></span> * <i>screen</i> )</h3> <p>Sets the screen for this mouse driver to be the given <i>screen</i>.</p> <p>This function was introduced in Qt 4.2.</p> <p><b>See also </b><a href="qwsmousehandler.html#limitToScreen">limitToScreen</a>().</p> <!-- @@@setScreen --> <!-- $$$suspend[overload1]$$$suspend --> <h3 class="fn"><a name="suspend"></a><span class="type">void</span> QWSMouseHandler::<span class="name">suspend</span> ()<tt> [pure virtual]</tt></h3> <p>Implement this function to suspend reading and handling of mouse events, e.g., call the <a href="qsocketnotifier.html#setEnabled">QSocketNotifier::setEnabled</a>() function to disable the socket notifier.</p> <p><b>See also </b><a href="qwsmousehandler.html#resume">resume</a>().</p> <!-- @@@suspend --> </div> </div> </div> </div> <div class="ft"> <span></span> </div> </div> <div class="footer"> <p> <acronym title="Copyright">©</acronym> 2013 Digia Plc and/or its subsidiaries. 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> Digia, Qt and their respective logos are trademarks of Digia Plc 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>