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

Reply via email to