Hi Denis,

I added the code you suggested. If I call setAcceptTouchEvents(true)
in the QGraphicsObject. I now receive all the touch events! However, I
do not receive any QGestureEvents with or without
setAcceptTouchEvents(true). If I call setAcceptTouchEvents(true), I
receive the following error:

QGestureManager::deliverEvent: could not find the target for gesture

When this happens the viewport is passed a QGestureEvent. However, I
really need the events to make it to the QGraphicsObject.

On Fri, Jun 18, 2010 at 7:11 AM, Denis Dzyubenko <[email protected]> wrote:
> Hi Sean,
>
> On 18 June 2010 05:19, Sean Hayes <[email protected]> wrote:
>> I am having problems getting any QGestureEvents on a QGraphicsObjects.
>> I think these events are not getting propagated properly. Here is an
>> example/test of an object that does not receive any QGestureEvents
>> that it grabs. Is this a Qt bug? I am using Qt 4.6.3 on Windows 7
>> (also tried Qt 4.7.0 beta 1).
>
> indeed that looks like a bug (or misfeature).
>
>> class TouchObject : public QGraphicsObject {
>>       Q_OBJECT
>> public:
>>       bool sceneEvent(QEvent* pEvent) {
>>               switch (pEvent->type()) {
>
> adding the following here seems to fix the issue.
>
> case  QEvent::TouchBegin:
>    pEvent->accept();
>    return true;
>
>>                       case QEvent::Gesture:
>>                               std::cout << "Gesture Event Received
>> from sceneEvent()" << std::endl;
>>               }
>>
>>               return QGraphicsObject::sceneEvent(pEvent);
>>       }
>
> --
> Best regards,
> Denis.
>

_______________________________________________
Qt4-preview-feedback mailing list
[email protected]
http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback

Reply via email to