Hello again,

I should have also added that QGraphicsScene::event() should only
return true for QGestureEvents if a QGraphicsObject target was found
for one or more of the QGestures received from a QGestureEvent. Is
there something I am missing?

Regards,
      Sean

On Tue, Jul 13, 2010 at 11:40 AM, sean.t.hayes
<[email protected]> wrote:
> Hi,
>
> I have confirmed that QGraphicsView::viewportEvent() returns true for all 
> QGestureEvents as long as the QGraphicsView is enabled (see lines 2770 to 
> 2782 of gui/graphicsview/qgraphicsview.cpp from Qt 4.6.3). From my 
> understand, I think a more correct implementation would be to only return 
> true if QGraphicsScene::event() returned true. That way it truly "Returns 
> true to indicate to the event system that the event has been handled, and 
> needs no further processing." Any thoughts on this or a workaround?
>
> Thank you,
> Sean
>
> On Tue, Jul 13, 2010 at 9:55 AM, Sean Hayes <[email protected]> 
> wrote:
>> Hi,
>>
>> Thank you for your help. It may be the case that the
>> QGraphicsView::viewportEvent(pEvent) is called first and redirects the
>> QGestureEvent to the QGraphicsObject. However, from my testing the
>> QGraphicsView::viewportEvent(pEvent) always returns true for
>> QGestureEvents, event when they were not used by a QGraphicsObject or
>> a QGraphicsItem. Likewise, the QEvent::isAccepted() always returns
>> true for QGestureEvents. I have tested this using the modified
>> function that follows while performing gestures directly on the view
>> (i.e., not on a QGraphicsObject or QGraphicsItem). I theorize that Qt
>> my accept all gestures in the view if viewport()->grabGesture() is
>> called for that gesture. Does anyone have any ideas of a work around
>> that would allow me to only use a gesture in the viewport if it was
>> not consumed by a QGraphicsObject?
>>
>> bool MyGraphicsView::viewportEvent(QEvent *pEvent) {
>>        bool used = QGraphicsView::viewportEvent(pEvent) && 
>> pEvent->isAccepted();
>>        if(!used && pEvent->type() == QEvent::Gesture) {
>>                std::cout <<
>>                        "Gesture Event Received from viewportEvent()" <<
>>                        std::endl;
>>                pEvent->accept();
>>                return true;
>>        }
>>
>>        return used;
>> }
>>
>> Regards,
>>     Sean
>>
>> On Tue, Jul 13, 2010 at 9:11 AM, Marcus Tillmanns
>> <[email protected]> wrote:
>>> Hi,
>>>
>>> I would guess that it first has to go through
>>> QGraphicsView::viewportEvent(pEvent); ( because it redirects the event to
>>> the correct GraphicsObject ). I'd guess that
>>> QGraphicsView::viewportEvent(pEvent); will return whether the event was
>>> consumed or not.
>>>
>>> Cheers,
>>> Marcus
>>>
>>>
>>> On [DATE], "Sean Hayes" <[ADDRESS]> wrote:
>>>
>>>> I am using Qt 4.6.3 with Windows 7 with Multi-Touch hardware. I am
>>>> creating a QGraphicsObject that receives QGestureEvents using the
>>>> following function:
>>>>
>>>> bool MyGraphicsObject::sceneEvent(QEvent* pEvent) {
>>>> switch (pEvent->type()) {
>>>> case QEvent::TouchBegin: // Needed to get around potential Qt bug
>>>> pEvent->accept();
>>>> return true;
>>>> case QEvent::Gesture:
>>>> std::cout << "Gesture Event Received from sceneEvent()" << std::endl;
>>>> pGestureEvent->accept();
>>>> return true;
>>>> }
>>>>
>>>> return QMapItem::sceneEvent(pEvent);
>>>> }
>>>>
>>>> However, those events are still getting passed to viewport because my
>>>> QGraphicsView is receiving them as well via:
>>>>
>>>> bool MyGraphicsView::viewportEvent(QEvent *pEvent) {
>>>> if(pEvent->type() == QEvent::Gesture) {
>>>>                 std::cout << "Gesture Event Received from
>>>> viewportEvent()" << std::endl;
>>>> pEvent->accept();
>>>> return true;
>>>> }
>>>>
>>>> return QGraphicsView::viewportEvent(pEvent);
>>>> }
>>>>
>>>> It seems to me that if the QGraphicsItem receives a gesture, the
>>>> gesture should not be passed to the viewpoint unless the QGraphicsItem
>>>> passes the event to its super class. Is that correct? Is there a way
>>>> for me to make this happen?
>>>>
>>>> Thank you for your help.
>>>> _______________________________________________
>>>> Qt4-preview-feedback mailing list
>>>> [email protected]
>>>> http://lists.trolltech.com/mailman/listinfo/qt4-preview-feedback
>>>
>>> Marcus Tillmanns
>>> Manager Software Engineering | P&S Creative Enthusiasts
>>>
>>> Avid
>>> Birkenstrasse 15
>>> 28195 Bremen
>>> Germany
>>> [email protected]
>>>
>>> t +49 421 4337599
>>>
>>> We're Avid.  Learn more at www.avid.com
>>>
>>> Avid Development GmbH; Paul-Heyse-Str. 29, D-80336 München
>>> Amtsgericht München HRB 155339, USt. ID. Nr. DE 814232828
>>> Geschäftsführer: Paige Parisi, Jochen Pielage, Kenneth A. Sexton
>>>
>>>
>>
>
>

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

Reply via email to