Results 1 to 5 of 5

Thread: Drop events

  1. #1
    Join Date
    May 2011
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Drop events

    Hi,

    I'm developing a painting application that needs support for Wacom tablet input and mouse input. The mouse part is working very well, but the Wacom tablet has a lot of drag.

    I have used qDebug to see the event info, and the problem is that Wacom sends a lot of events, and the mouse sends very few. It is like the mouse events are generated when the application requests them (idle?) while the wacom tablet events are sent like every x milliseconds and placed in a list...

    This is what the mouse list looks like:

    Mouse.Press : 200, 476
    Mouse.Move : 200, 476
    Mouse.Move : 210, 476
    Mouse.Move : 220, 476
    Mouse.Release : 220, 476

    And this is what the tablet list looks like:

    Tablet.Press : 200, 476
    Tablet.Move : 200, 476
    Tablet.Move : 200, 476
    Tablet.Move : 200, 476
    Tablet.Move : 200, 476
    Tablet.Move : 201, 476
    Tablet.Move : 201, 476
    Tablet.Move : 201, 476
    Tablet.Move : 202, 476
    Tablet.Move : 202, 476
    Tablet.Move : 202, 476
    Tablet.Move : 202, 476
    Tablet.Release : 202, 476

    So, my question is... is there a way to clear this list or eliminate all QXXXEvent events from the event loop.

    Thank you!

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Drop events

    This is related to the tablet driver. It is responsible for producing those events and in normal circumstances they are usefull to detect the "pressure" of the pen on the tablet (at least that's my guess). Since the mouse doesn't have such concept, it only generates events when you move the pointer. You might try tweaking the options of your tablet driver but there is nothing you can do with it inside your application, you can just ignore those events yourself.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    May 2011
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Drop events

    Thanks wysota,
    The thing is that I don't know which events to ignore, and which ones to process.
    Is it possible to check all the list of events waiting to be processed, and flag those events that should be ignored. I could do this when my tool finishes processing the QTabletEvent... then I can check the list of events and flag (?) all those QTabletEvents in the list.
    Thanks again!

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,017 Times in 4,793 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Drop events

    You have to base the decision of which events to ignore on what your application is doing and the purpose of handling the events in the first place. Nobody is going to decide it for you.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. #5
    Join Date
    May 2011
    Posts
    5
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Drop events

    Thank you wysota,

    I found two methods for ignoring the unwanted TabletMove events. I'm posting it here for if somebody else needs something similar:

    1. The easy one:
    A mod operator ignores 15 of every 16 TabletMove events. Fast to implement but it's not balanced... some processing (like orbiting a 3D viewport) is dependant on content and this method can still have a lot of drag, or feel not continuous.

    2. A QAcceptTabletEvent event.
    After my event is processed by tabletEvent I set a m_ignore_tablet_event flag to true, and then post a new QAcceptTabletEvent to my widget. Next tabletEvent is called, if my m_ignore_tablet_event is false and the event is tabletMove, I ignore it, otherwise, I process it.
    On event() I set m_ignore_tablet_events to false.
    So this two brackets ignore all events that were posted by the tablet while the previous QTabletEvent was being processed by my widget.

    http://sceneengine.svn.sourceforge.n...91&view=markup
    line: 53
    line: 214
    line: 231

    Note: I only ignore QEvent::tabletMove events... QEvent::tabletRelease and QEvent::TabletPress should always be processed!

    Thanks!

Similar Threads

  1. Replies: 2
    Last Post: 13th October 2010, 21:51
  2. Handle Drag & Drop Events with QGraphicsItem [SOLVED]
    By guilugi in forum Qt Programming
    Replies: 2
    Last Post: 13th July 2010, 18:05
  3. Replies: 0
    Last Post: 4th May 2010, 10:24
  4. QComboBox drop list button events
    By maird in forum Qt Programming
    Replies: 5
    Last Post: 20th October 2007, 19:25
  5. Drag and Drop (drop example)
    By din9 in forum Qt Programming
    Replies: 1
    Last Post: 23rd January 2006, 18:03

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
  •  
Qt is a trademark of The Qt Company.