[email protected]
[Top] [All Lists]

Re: [Qt4-preview-feedback] Gestures not received on QGraphicsObjects

Subject: Re: [Qt4-preview-feedback] Gestures not received on QGraphicsObjects
From: Denis Dzyubenko
Date: Fri, 18 Jun 2010 14:11:09 +0200
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 {
> public:
> Â Â Â bool sceneEvent(QEvent* pEvent) {
> Â Â Â Â Â Â Â switch (pEvent->type()) {

adding the following here seems to fix the issue.

case  QEvent::TouchBegin:
    return true;

> Â Â Â Â Â Â Â Â Â Â Â case QEvent::Gesture:
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â std::cout << "Gesture Event Received
> from sceneEvent()" << std::endl;
> Â Â Â Â Â Â Â }
> Â Â Â Â Â Â Â return QGraphicsObject::sceneEvent(pEvent);
> Â Â Â }

Best regards,

Qt4-preview-feedback mailing list
[email protected]
<Prev in Thread] Current Thread [Next in Thread>