Hi Denis,

When I tested your fix earlier I did not call grabGesture on the
Viewport. With this addition and setAcceptTouchEvents(true) I now
receive QPinchEvents within the QGraphicsObject class in both event()
and sceneEvent()! What is the preferred function to access these
events? I think the documentation should make these requirements
clearer.

I am still receiving the message, "QGestureManager::deliverEvent:
could not find the target for gesture" when I try pan gestures.
Looking with qstandardgestures.cpp I noticed that the
QPanGestureRecognizer does not set a hotspot. I would guess that is
the problem.

Thank you so much for your help. I am going to try implementing a
custom gesture recognizer an test that. Let me know if I can be of
service testing any patches that are made or in other ways.

Thank you again,
      Sean

On Fri, Jun 18, 2010 at 8:21 AM, Sean Hayes <[email protected]> wrote:
> 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