Results 1 to 3 of 3

Thread: Twice QWidget::event TouchBegin instead one

  1. #1
    Join Date
    Mar 2011
    Posts
    8
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Twice QWidget::event TouchBegin instead one

    I wrote an application for raspberry with qt 5.3, raspbian jessie and a 7-inch touch screen.
    In my application I need to override the QWidget::event method. And everything was worked ok.
    My problems start when I ported my code to raspbian stretch with the qt 5.7.1.
    Now my code doesn't work because the QEvent::TouchBegin event is sent twice time.
    Do you have any suggestions?

    Code
    Qt Code:
    1. bool Zone::event(QEvent *e)
    2. {
    3. if (e->type() == QEvent::TouchBegin) {
    4. qDebug("TouchBegin");
    5. .........
    6. return true;
    7. }
    8.  
    9. if (e->type() == QEvent::TouchEnd) {
    10. qDebug("TouchEnd");
    11. .....
    12. return true;
    13. }
    14.  
    15. if (e->type() == QEvent::MouseButtonPress) {
    16. qDebug("MouseButtonPress");
    17. .....
    18. return true;
    19. }
    20.  
    21. if (e->type() == QEvent::MouseButtonRelease) {
    22. qDebug("MouseButtonRelease");
    23. .......
    24. return true;
    25. }
    26. return QWidget::event(e);
    27. }
    To copy to clipboard, switch view to plain text mode 

    Output
    TouchBegin
    TouchBegin
    MouseButtonPresseds
    TouchEnd
    MouseButtonReleased
    Last edited by anda_skoa; 12th April 2019 at 10:31. Reason: missing [code] tags

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,292
    Thanks
    36
    Thanked 1,521 Times in 1,472 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Twice QWidget::event TouchBegin instead one

    Hard to tell.

    Could be a bug in the touch input driver or further up in the stack.

    Since you have QtWidgets application my guess is that you are using one of the window system stacks, i.e. X11 or Wayland.

    In case of X11 you could try running the "xev" tool and see which events it gets from the X-Server.

    Cheers,
    _

  3. #3
    Join Date
    Mar 2011
    Posts
    8
    Qt products
    Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Twice QWidget::event TouchBegin instead one

    thanks for the suggestion, I use linuxfb.
    I'll try to investigate about /dev/input/event0
    to understand if two events are generated
    Bye

Similar Threads

  1. QTouchEvent : No TouchBegin if I don't Move or Up
    By Rajesh.Rathod in forum Qt Programming
    Replies: 0
    Last Post: 16th September 2015, 13:40
  2. Close Event in for a qwidget
    By ehnuh in forum Qt Programming
    Replies: 0
    Last Post: 30th October 2012, 05:31
  3. Replies: 0
    Last Post: 23rd November 2010, 20:54
  4. QWidget Shown Event
    By perq in forum Qt Programming
    Replies: 1
    Last Post: 13th September 2010, 15:20
  5. QWidget post event
    By bunjee in forum Qt Programming
    Replies: 1
    Last Post: 14th November 2008, 18:07

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.