+ Reply to Thread
Results 1 to 6 of 6

Thread: Using touch screen affects both qt application and desktop

  1. #1
    Join Date
    Apr 2017
    Posts
    5
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Using touch screen affects both qt application and desktop

    Hello,

    I am having a problem with my X11 qt5 application running on a raspberry pi 3 (os - Jessie) connected to the official raspberry pi 7 inch touch screen display.

    The application works exactly as desired if using a mouse, but when the user uses the touch screen, the event is ALSO picked up and handled by the desktop. In other words, if i press on a location where i know a desktop icon to be (while it is covered by my full screen application), the system will think I am trying to open that new application, or move it, etc.

    I found this thread: http://www.qtcentre.org/threads/6621...erating-system
    that describes an identical problem, but unfortunately there was no resolution.

    I'm spinning my wheels trying to figure this one out. Does anyone have any suggestions? I will of course provide any necessary information, I'm just not sure what exactly is relevant at this point.

  2. #2
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    158
    Thanks
    67
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: Using touch screen affects both qt application and desktop

    But you do accept those events, do you?

  3. The following user says thank you to sedi for this useful post:

    msheron (27th April 2017)

  4. #3
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    3,405
    Thanks
    200
    Thanked 530 Times in 520 Posts
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows Android

    Default Re: Using touch screen affects both qt application and desktop

    But you do accept those events, do you?
    In other words, in your event handler, you call the method QEvent::accept() through the pointer to the event. If not, then the event will be sentup the line for further handling.
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

  5. The following user says thank you to d_stranz for this useful post:

    msheron (27th April 2017)

  6. #4
    Join Date
    Apr 2017
    Posts
    5
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Using touch screen affects both qt application and desktop

    Hello, Thanks for the replies.

    I fear I might have explained my issue poorly. My application uses widgets that implement mouseEvent handlers, and in those handlers I do accept the events. I read somewhere that for most use cases this should be sufficient for implementing touch features (just basic 'clicking'/'pressing' is all I require), and until now this had been ringing true. I am developing the application directly on a raspberry pi 3 connected to a usb touch screen monitor. When the application is running on the usb monitor, everything works exactly as intended; Mouse clicks are mouse clicks and touches are mouse clicks that do not interact with anything but the application window.

    The problem only appears when running the application on the 7 inch touch screen. Mouse clicks stop at the application window, but pressing with a finger goes to and through the application to the desktop -- Anywhere, whether on a widget or just the application window itself. Actually, I made a new project with a blank MainWindow and was able to recreate the behavior, so I'm thinking it's not even really my code, but rather the screen or X11 erroneously sending events to the desktop as well.

    And if that is actually the case, would anyone know how to test for / fix that?

  7. #5
    Join Date
    Apr 2017
    Posts
    5
    Thanks
    2
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default Re: Using touch screen affects both qt application and desktop

    Hello again,

    I resolved this problem well enough for my purposes. Just wanted to follow up and leave a record of it in case anyone else has to deal with this.

    I was never able to figure out what the root cause was, so a workaround was required instead. So if the desktop receiving events from "underneath" the application was the problem, removing the desktop should be the solution. And that's exactly what I did; Using raspi-config, I set the raspberry pi to boot into a console (tty1). After that, I added my application to start on '@reboot' with crontab. If the desktop is ever required for any reason, the application can be closed with 'ctrl+alt+backspace', followed by a 'startx' command at the terminal to launch the desktop.

    So while this is not a fix to the real problem, it certainly mitigates what was a show-stopper into a minor inconvenience at worst.

    Thanks again for your interest.

  8. #6
    Join Date
    Jan 2012
    Location
    Dortmund, Germany
    Posts
    158
    Thanks
    67
    Thanked 10 Times in 8 Posts
    Qt products
    Qt4
    Platforms
    Windows Android

    Default Re: Using touch screen affects both qt application and desktop

    Hm - this really sounds like a bug to me. Would you mind raising this issue on the interest@qt-project.org mailing list or / and create a bug report on https://bugreports.qt.io/?

    [Edited:] Oops. Didn't see how old this post was. Nevermind.
    Last edited by sedi; 23rd August 2017 at 01:03.

+ Reply to Thread

Similar Threads

  1. Touch not working on qt application using waveshare screen
    By kachhadiyatushar in forum Qt for Embedded and Mobile
    Replies: 10
    Last Post: 6th December 2016, 04:29
  2. Touch screen wrong coordinates on touch
    By Talei in forum Qt Programming
    Replies: 0
    Last Post: 1st January 2014, 23:35
  3. QT interfacing with touch screen!!!
    By sanujas in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 5th April 2013, 12:03
  4. Replies: 2
    Last Post: 11th June 2010, 08:23
  5. Touch screen
    By rchaitanya in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 19th January 2009, 14:40

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