Results 1 to 2 of 2

Thread: Qt Embedded Touchscreen QMouseEvents Not Received Until MouseButtonRelease Received

  1. #1
    Join Date
    Jul 2012
    Posts
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Qt Embedded Touchscreen QMouseEvents Not Received Until MouseButtonRelease Received

    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.

    Qt Code:
    1. So what I'm seeing from the point of view of events received when I pressed down and then release looks like:
    2.  
    3. 50 SockAct <-- Received right at press down
    4. <-- NO Other events received until press released
    5. <-- Now release by lifting finger from screen
    6. 50 SockAct <-- Immediately received a 50 ( SockAct ) and the rest of the events below:
    7. 2 <-- 2 == mouse down
    8. 2 <-- 2 == mouse down
    9. 3 <-- 3 == mouse release / up
    10. 3 <-- 3 == mouse release / up
    11. 77 <-- 77 == redraw
    To copy to clipboard, switch view to plain text mode 

    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.

    I'm not sure why I'm seeing the behavior I do. There must be a translation issue between Qt and the input device.

    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

    Does anybody know how to fix this or what may be causing this?? Thank you very much!

    --

    I don't see the following printed out until I actually lift my finger:

    Qt Code:
    1. ...
    2. MOVE TYPE: 5
    3. "Mouse move (382,129)"
    4. MOUSE BUTTON PRESS TYPE: 2
    5. "Mouse Button Press (1)"
    6. MOUSE BUTTON RELEASE TYPE: 3
    7. "Mouse Button Release (1)"
    8. ....
    To copy to clipboard, switch view to plain text mode 

    Here is my eventFilter where I examine my received events in my App:

    Qt Code:
    1. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    2. // Just for kicks print out the mouse position
    3. if (event->type() == QEvent::MouseButtonPress)
    4. {
    5. qDebug() << "MOUSE BUTTON PRESS TYPE: " << event->type();
    6. QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
    7. qDebug() << QString("Mouse Button Press (%1)").arg(mouseEvent->button());
    8. }
    9. if (event->type() == QEvent::MouseMove)
    10. {
    11. qDebug() << "MOVE TYPE: " << event->type();
    12. QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
    13. qDebug() << QString("Mouse move (%1,%2)").arg(mouseEvent->globalX()).arg(mouseEvent->globalY());
    14. }
    15. if (event->type() == QEvent::MouseButtonRelease)
    16. {
    17. qDebug() << "MOUSE BUTTON RELEASE TYPE: " << event->type();
    18. QMouseEvent *mouseEvent = static_cast<QMouseEvent*>(event);
    19. delay();
    20. qDebug() << QString("Mouse Button Release (%1)").arg(mouseEvent->button());
    21. //return true; // Gobble the event
    22. }
    23. ////////////////////////////////////////////////////////////////////////////////////////////////////////////
    To copy to clipboard, switch view to plain text mode 

    Here is my delay function:

    Qt Code:
    1. void Monitor::delay()
    2. {
    3. QTime dieTime = QTime::currentTime().addMSecs(3);
    4. while( QTime::currentTime() < dieTime )
    5. QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
    6. }
    To copy to clipboard, switch view to plain text mode 

  2. #2
    Join Date
    Jul 2012
    Posts
    13
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Qt Embedded Touchscreen QMouseEvents Not Received Until MouseButtonRelease Receiv

    Solved- I found this thread: https://github.com/kergoth/tslib/issues/10 which outlines the same problem. It seems to be an issue in Tslib with the Atmel MXT Maxtouch driver. Commenting out the Variance module in the ts.conf file solved my problem - I now get mouse down events immediately after touching the screen.

Similar Threads

  1. Replies: 5
    Last Post: 6th September 2011, 12:17
  2. TCP: Don't process until a whole packet is received
    By P@u1 in forum Qt Programming
    Replies: 1
    Last Post: 10th June 2011, 13:11
  3. Methods to display received data
    By pupqt in forum Qt Programming
    Replies: 3
    Last Post: 18th April 2011, 10:50
  4. Replies: 0
    Last Post: 11th August 2010, 20:00
  5. Replies: 1
    Last Post: 10th February 2010, 13:07

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.