PDA

View Full Version : touchEvent register on a single widget on a multitouch screen



tihoulas
10th April 2010, 14:45
Hi,

I am currently trying to create a multitouch onscreen keyboard.
I own an asus t91mt, which has a dualtouch touchscreen.
My problem is that, although a TouchEvent can registers up to 2 touches, two different widgets cannot be touched at the same time.

It seems that once a widget recieves a TouchEvent, other widgets cannot, so that the second finger touch can only be recieved by the first widget touched.

All my widgets have the Qt::WA_AcceptTouchEvents property set.

Does anybody knows a way to bypass that issue ?

I would really like some help here, as I have been banging my head on the walls trying to figure that out.

Thanks in advance.

tihoulas
14th April 2010, 19:03
A quick update :
I have finally found that using setAttribute(Qt::AA_DontCreateNativeWidgetsSibblin gs) on my app allows it to function properly. But only with the first multi touch event. I cant press two buttons simultaneously, but only once. Any further atempt will miserably fail.

Is this a bug , or I have missed yet another thing ?

dpatel
16th November 2010, 04:24
I am also facing exactly same issue.
The fingerpaint example works fine but the Multitouch Dial example doesn't work. I am using Qt 4.6.2 and Qt Creator 1.3
Does anyone know how to solve the issue?

dpatel
16th November 2010, 12:52
Update:

Currently I am trying that two buttons receive touch event at the same time. But only one button receives the event.

Now if I place the buttons on a QFrame, they receive multitouch event but only for the first time, after that only one button receives touch event.
Here behavior is similar to post#2 by tihoulas.

I don't know what different happens when I place the buttons on QFrame. Any pointers would be helpful. Can some one point me to Nokia/Qt guys who might know about it?

Thanks

dpatel
2nd December 2010, 06:51
Update:

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


if(QCoreApplication::testAttribute(Qt::AA_DontCrea teNativeWidgetSiblings)==false)
that->setAttribute(Qt::WA_NativeWindow);

instead of


that->setAttribute(Qt::WA_NativeWindow);

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 1 2 minutes:

FYI:

This is a bug and is already reported to Qt team. You can track it at Qt-BugReport (http://bugreports.qt.nokia.com/browse/QTBUG-14004)