Results 1 to 2 of 2

Thread: Qt Multi-touch Dials example not working as expected

  1. #1
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Qt Multi-touch Dials example not working as expected

    Hi,

    I am trying to test the Dials Multitouch example which comes along with Qt. I am not sure is the issue in my setup, touch screen or Qt. I am facing exactly same issue (well partially) described here

    Here is my project setup.

    Qt 4.6.2
    Qt Creator 1.3.1
    Win 7 32 bit OS
    Hp Compaq L2105tm Multitouch Monitor (supports 2 touches)

    I am able to compile and run the application with following issues.

    Firstly I have to add in main.cpp of the example (to receive multitouch event even for the first time)

    Qt Code:
    1. QCoreApplication::setAttribute(Qt::AA_DontCreateNativeWidgetSiblings);
    To copy to clipboard, switch view to plain text mode 

    In release mode I can rotate two knobs only for the first time for each knob.
    Usecases
    Rotate knb1 knb2 -> works fine first time
    Rotate knb1 knb2 again -> only one knob will rotate.
    Rotate knb3 knb4 -> works fine since these knobs are rotated for the first time.
    Now any combination of knobs between 1-4 will not work as expected. Only one knob is rotated even if I try to rotate two knobs.

    In debug mode all the above cases work fine, i.e I can rotate any combination of two knobs any number of times (70% of times). Sometimes debug build is also not working as expected.

    After digging into the issue for two days I found

    (1) that in case of failures the touch event is directly received by the knobs and in case of correct behavior the touch event is first received by containing widget of knobs(int this case its QWidget) and from there the event is propagated to respective knob.

    (2) In case of correct behavior the code returns from
    Qt Code:
    1. if (!isActive())
    2. {
    3. return;
    4. }
    To copy to clipboard, switch view to plain text mode 
    which is at around line 230 in qt\src\gui\accessible\qaccessible_win.cpp. While in case of incorrect behavior the code goes further down in that function.

    In case if its of any help, here goes the stack trace in case of correct behavior

    Qt Code:
    1. 0 QDial::mouseMoveEvent qdial.cpp 349 0x00a29e70
    2. 1 QWidget::event qwidget.cpp 7983 0x006dc938
    3. 2 QAbstractSlider::event qabstractslider.cpp 956 0x009fbe56
    4. 3 QDial::event qdial.cpp 508 0x00a2a2a0
    5. 4 QApplicationPrivate::notify_helper qapplication.cpp 4300 0x00692520
    6. 5 QApplication::notify qapplication.cpp 3865 0x00690723
    7. 6 QCoreApplication::notifyInternal qcoreapplication.cpp 704 0x6a1fd302
    8. 7 QCoreApplication::sendEvent qcoreapplication.h 215 0x00ce6f9e
    9. 8 QWidget::event qwidget.cpp 8431 0x006ddbcf
    10. 9 QAbstractSlider::event qabstractslider.cpp 956 0x009fbe56
    11. 10 QDial::event qdial.cpp 508 0x00a2a2a0
    12. 11 QApplicationPrivate::notify_helper qapplication.cpp 4300 0x00692520
    13. 12 QApplication::notify qapplication.cpp 4265 0x006923a0
    14. 13 QCoreApplication::notifyInternal qcoreapplication.cpp 704 0x6a1fd302
    15. 14 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 218 0x00ce6f4a
    16. 15 QApplicationPrivate::translateRawTouchEvent qapplication.cpp 5670 0x006941fc
    17. 16 QApplicationPrivate::translateTouchEvent qapplication_win.cpp 4067 0x006fa075
    18. 17 QtWndProc@16 qapplication_win.cpp 1680 0x006f2e8f
    19. 18 USER32!IsWindowVisible C:\Windows\system32\user32.dll 0 0x777f86ef
    20. 19 ?? 0 0x00060534
    21. 20 ?? 0 0x00000240
    To copy to clipboard, switch view to plain text mode 

    Stack trace in case of incorrect behavior
    Qt Code:
    1. 0 QWidgetPrivate::registerTouchWindow qwidget_win.cpp 2050 0x0096e706
    2. 1 QWidgetPrivate::create_sys qwidget_win.cpp 494 0x00968781
    3. 2 QWidget::create qwidget.cpp 1319 0x0092ba61
    4. 3 QWidgetPrivate::createWinId qwidget.cpp 2310 0x0092f84e
    5. 4 QWidget::setAttribute qwidget.cpp 10392 0x00940f38
    6. 5 QWidget::winId qwidget.cpp 2281 0x0092f63a
    7. 6 QAccessible::updateAccessibility qaccessible_win.cpp 286 0x00db2145
    8. 7 QAbstractSlider::setValue qabstractslider.cpp 539 0x00c5b49a
    9. 8 QAbstractSlider::triggerAction qabstractslider.cpp 631 0x00c5b6fd
    10. 9 QAbstractSlider::setSliderPosition qabstractslider.cpp 499 0x00c5b397
    11. 10 QDial::mouseMoveEvent qdial.cpp 356 0x00c89ef6
    12. 11 QWidget::event qwidget.cpp 7983 0x0093c938
    13. 12 QAbstractSlider::event qabstractslider.cpp 956 0x00c5be3a
    14. 13 QDial::event qdial.cpp 508 0x00c8a284
    15. 14 QApplicationPrivate::notify_helper qapplication.cpp 4300 0x008f2520
    16. 15 QApplication::notify qapplication.cpp 3865 0x008f0723
    17. 16 QCoreApplication::notifyInternal qcoreapplication.cpp 704 0x6a1fd302
    18. 17 QCoreApplication::sendEvent qcoreapplication.h 215 0x00f46f7e
    19. 18 QWidget::event qwidget.cpp 8430 0x0093dbb3
    20. 19 QAbstractSlider::event qabstractslider.cpp 956 0x00c5be3a
    21. 20 QDial::event qdial.cpp 508 0x00c8a284
    22. 21 QApplicationPrivate::notify_helper qapplication.cpp 4300 0x008f2520
    23. 22 QApplication::notify qapplication.cpp 4265 0x008f23a0
    24. 23 QCoreApplication::notifyInternal qcoreapplication.cpp 704 0x6a1fd302
    25. 24 QCoreApplication::sendSpontaneousEvent qcoreapplication.h 218 0x00f46f2a
    26. 25 QApplicationPrivate::translateRawTouchEvent qapplication.cpp 5670 0x008f41fc
    27. 26 QApplicationPrivate::translateTouchEvent qapplication_win.cpp 4067 0x0095a059
    28. 27 QtWndProc@16 qapplication_win.cpp 1680 0x00952e73
    29. 28 USER32!IsWindowVisible C:\Windows\system32\user32.dll 0 0x777f86ef
    30. 29 ?? 0 0x00020362
    31. 30 ?? 0 0x00000240
    32. 31 USER32!IsWindowVisible C:\Windows\system32\user32.dll 0 0x777f8876
    33. 32 qt_is_translatable_mouse_event qapplication_win.cpp 1395 0x009520dd
    34. 33 USER32!IsWindowVisible C:\Windows\system32\user32.dll 0 0x777f89b5
    35. 34 ?? 0 0x00000000
    To copy to clipboard, switch view to plain text mode 
    Note:
    The FingerPaint example that Qt provides works fine. I can draw with two finger everytimes (since my monitor only supports two simultaneous touches).

    Now please enlighten me what going wrong here. I suspect that this issue is related to focus of the widgets.

    Any pointers to further investigation or solution are appreciated.

    Thanks

  2. #2
    Join Date
    Feb 2010
    Posts
    99
    Thanks
    31
    Thanked 3 Times in 3 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Qt Multi-touch Dials example not working as expected

    Update:

    I have posted the response on another thread but in case someone finds the information useful.

    I think I have found the cause of this issue but not sure if that's by design or a bug in QWidget.
    As explained in above posts first time two widgets receive multi-touch events but after that only one widget receives touch events.
    Usually Qt doesn't create separate native widgets for each widget that is placed upon main window (unless Qt::WA_NativeWindow attribute is set). It only creates one native widget and maintains child widgets. You can confirm this using Spy++ (which comes along with Visual Studio) or similar tool. I found that after the first touch/mouse event, Qt creates a native widget for the knob even if QCoreApplication::setAttribute(Qt::AA_DontCreateNa tiveWidgetSiblings) is done. So now if you touch that knobs it will grab the touch event and won't allow other knobs to receive simultaneous event.

    I also made changes in QWidget::winID() and added following code
    Qt Code:

    Qt Code:
    1. if(QCoreApplication::testAttribute(Qt::AA_DontCreateNativeWidgetSiblings)==false)
    2. that->setAttribute(Qt::WA_NativeWindow);
    To copy to clipboard, switch view to plain text mode 

    instead of

    Qt Code:
    1. that->setAttribute(Qt::WA_NativeWindow);
    To copy to clipboard, switch view to plain text mode 


    My changes fixes issue, and now I can move multiple knobs simultaneously more than once. Let me know if someone thinks that this might break something. Also let me know where can I post this issue so that Qt team can fix it or justify current behavior


    Added after 57 minutes:


    FYI:

    This is a bug and is already reported to Qt team. You can track it at Qt-BugReport
    Last edited by dpatel; 2nd December 2010 at 06:50.

Similar Threads

  1. Replies: 0
    Last Post: 18th November 2010, 16:48
  2. Replies: 0
    Last Post: 17th August 2010, 14:37
  3. Replies: 10
    Last Post: 2nd August 2010, 14:07
  4. Replies: 1
    Last Post: 6th February 2010, 09:54
  5. QTableView not working as expected.
    By junxuan in forum Qt Programming
    Replies: 7
    Last Post: 30th July 2009, 08:17

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.