Android : Qt TouchBegin touchPoint.pos() is stuck at 0,0

on Friday, October 10, 2014


I am coding an android application in QT and when the TouchEvent is emitted my touchEvent->touchPoints().at(newPoint).pos() is always 0,0 until I move my finger and force a TouchUpdate event. Is there a way to get the position on TouchBegin? Below is my event code:



bool event(QEvent* e)
{
switch(e->type())
{
case QEvent::TouchBegin:
touchEvent = static_cast<QTouchEvent*>(e);
emit touchBegin();
emit touchUpdate();
return true;
case QEvent::TouchUpdate:
touchEvent = static_cast<QTouchEvent*>(e);
emit touchUpdate();
return true;
case QEvent::TouchEnd:
emit touchEnd();
return true;
default:
return QWidget::event(e);
}
}

0 comments:

Post a Comment