title: Qt Embedded Touchscreen QMouseEvents Not Received Until MouseButtonRelease Received
body: <p>I am using Qt 4.8.3 on a small ARM embedded Linux device with a touchscreen. I have my touchscreen configured with tslib and calibrated it so there is a pointercal file in /etc/. The locations of my touch events work just fine but no matter what I get a QEvent for Mouse Move before Mouse Press or Mouse Release Events. Furthermore, I don't get any Mouse Related Events until I physically lift my finger from the touchscreen. I need normal behavior where I press on the touchscreen and receive a mouse down event immediately and then my move events ( if there are any ) and then a mouse release event when I lift my finger. </p>
  
  <pre><code>So what I'm seeing from the point of view of events received when I pressed down and then release looks like:
  
  50 SockAct &lt;-- Received right at press down
             &lt;-- NO Other events received until press released
             &lt;-- Now release by lifting finger from screen
  50 SockAct &lt;-- Immediately received a 50 ( SockAct ) and the rest of the events below:
  2          &lt;-- 2 == mouse down
  2          &lt;-- 2 == mouse down
  3          &lt;-- 3 == mouse release / up
  3          &lt;-- 3 == mouse release / up
  77         &lt;-- 77 == redraw
  </code></pre>
  
  <p>I also attempted to look at the QWS Server events by implementing the following qwsEventFilter to watch QWS events that come in to my QApplication:</p>
  
  <pre><code>/// For investigation mouse events
  #include &lt;QWSServer&gt;
  #include &lt;QWSMouseHandler&gt;
  #include &lt;QWSEvent&gt;
  
  bool GUIApp::qwsEventFilter(QWSEvent *e)
  {
  
      qDebug() &lt;&lt; e-&gt;type;
  
      if(e-&gt;type == QWSEvent::Mouse) {
  
          QWSMouseHandler *curMouse = QWSServer::mouseHandler();
          qDebug() &lt;&lt; "mouse position is: " &lt;&lt; curMouse-&gt;pos();
  
      }
  
      return false;
  
      /*
      QWSEvent::NoEvent   0   No event has occurred.
      QWSEvent::Connected 1   An application has connected to the server.
      QWSEvent::Mouse 2   A mouse button is pressed or released, or the mouse cursor is moved. See also Qt for Embedded Linux Pointer Handling.
      */
  
  }
  </code></pre>
  
  <p>Now, when I launch my App I am seeing the same behavior after touching the screen -- that is the following is printed:</p>
  
  <pre><code>2 &lt;-- Nothing is printed until I release my finger from the screen!
  mouse position is:  QPoint(89,312) 
  2 
  mouse position is:  QPoint(89,312) 
  </code></pre>
  
  <p>As you can see as soon as I release my finger I get 2 events, presumably press down and release.</p>
  
  <p>I've run 'evtest' on my /dev/input/touchscreen device in Linux and certainly see a touch down event immediately when pressing down on the screen. And I do not get a mouse release event until I lift my finger, so the driver behaves as expected. There are also no 'repeat' touch down events when I press - it is just one event for one press down , but behaves correctly. </p>
  
  <p>I'm not sure why I'm seeing the behavior I do. There must be a translation issue between Qt and the input device. </p>
  
  <p>Furthermore, If I add a small 3ms delay in processing my MouseButtonRelease received event, then I get desired behavior in terms of how the app works but I still do not receive my Mouse events until I release the press. I should not have to add a delay at all, I would expect my mouse down to happen, then any moves, and finally a mouse up event in turn</p>
  
  <p>Does anybody know how to fix this or what may be causing this?? Thank you very much!</p>
  
  <p>--</p>
  
  <p>I don't see the following printed out until I actually lift my finger:</p>
  
  <pre><code>...
  MOVE TYPE:  5 
  "Mouse move (382,129)" 
  MOUSE BUTTON PRESS TYPE:  2 
  "Mouse Button Press (1)" 
  MOUSE BUTTON RELEASE TYPE:  3 
  "Mouse Button Release (1)" 
  ....
  </code></pre>
  
  <p>Here is my eventFilter where I examine my received events in my App:</p>
  
  <pre><code>////////////////////////////////////////////////////////////////////////////////////////////////////////////
  // Just for kicks print out the mouse position
  if (event-&gt;type() == QEvent::MouseButtonPress)
  {
      qDebug() &lt;&lt; "MOUSE BUTTON PRESS TYPE: " &lt;&lt; event-&gt;type();
      QMouseEvent *mouseEvent = static_cast&lt;QMouseEvent*&gt;(event);
      qDebug() &lt;&lt; QString("Mouse Button Press (%1)").arg(mouseEvent-&gt;button());
  }
  if (event-&gt;type() == QEvent::MouseMove)
  {
      qDebug() &lt;&lt; "MOVE TYPE: " &lt;&lt; event-&gt;type();
      QMouseEvent *mouseEvent = static_cast&lt;QMouseEvent*&gt;(event);
      qDebug() &lt;&lt; QString("Mouse move (%1,%2)").arg(mouseEvent-&gt;globalX()).arg(mouseEvent-&gt;globalY());
  }
  if (event-&gt;type() == QEvent::MouseButtonRelease)
  {
      qDebug() &lt;&lt; "MOUSE BUTTON RELEASE TYPE: " &lt;&lt; event-&gt;type();
      QMouseEvent *mouseEvent = static_cast&lt;QMouseEvent*&gt;(event);
      delay();
      qDebug() &lt;&lt; QString("Mouse Button Release (%1)").arg(mouseEvent-&gt;button());
      //return true; // Gobble the event
  }
  ////////////////////////////////////////////////////////////////////////////////////////////////////////////
  </code></pre>
  
  <p>Here is my delay function:</p>
  
  <pre><code>void Monitor::delay()
  {
      QTime dieTime = QTime::currentTime().addMSecs(3);
      while( QTime::currentTime() &lt; dieTime )
      QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
  }
  </code></pre>