[Qt-interest] Gestures

Luiz Geovani Vier lgvier at gmail.com
Mon Aug 9 21:47:48 CEST 2010


Hi Carl,

Are you accepting touch events? You might want to check if you are receiving
them properly.
Also, in case you're using a QGraphicsScene, you also have to accept the
Touch down event on the items to start receiving gestures.

I sent a gestures-related question to this list yesterday; it contains a
sample app that you could use, as it contains a custom Pan gesture
recognizer.

Hope that helps...

-Geovani

On Mon, Aug 9, 2010 at 3:28 PM, Carl Snellman <carl.snellman at gmail.com>wrote:

> Hey,
>
> sorry for repost, but I'm now blocked with the basic gesture
> recognizer not working. If there is anyone out there having any
> suggestions, I would be more than happy to hear...
>
> Thanks,
> Carl
>
> ---------- Forwarded message ----------
> From: Carl Snellman <carl.snellman at gmail.com>
> Date: Fri, Aug 6, 2010 at 3:10 PM
> Subject: Re: [Qt-interest] Gestures
> To: qt-interest at trolltech.com
>
>
> Hey Denis and others,
>
> (apologies for bringing such old thread back alive; I've been working
> on other stuff, and now got back to this)
>
> I tried to implement my own gesture recognizer and bumped to a problem
> right away.
> I implemented the following recognizer:
> >>>>>>>>>>>>>>>>>>>>>.
> class MyTapGesture : public QTapGesture {
> };
>
> class MyGestureRecognizer : public QGestureRecognizer {
> public:
>    virtual QGesture *create ( QObject * target ) {
>        qDebug() << "MyGestureRecognizer::create";
>        return new MyTapGesture;
>    }
>    virtual void reset ( QGesture * gesture ) {
>        qDebug() << "MyGestureRecognizer::reset";
>    }
>
>    virtual Result recognize(QGesture * gesture, QObject * watched,
> QEvent * event) {
>        qDebug() << "MyGestureRecognizer::recognize";
>        return QGestureRecognizer::Ignore;
>    }
> };
> <<<<<<<<<<<<<<<<<<<<<<<<<<<
>
> then I registered the recognizer:
>
> Qt::GestureType type = QGestureRecognizer::registerRecognizer(new
> MyGestureRecognizer);
> qDebug() << "Type:" << type;
>
>
> The problem is that MyGestureRecognizer::recognize(..) never gets called!
> I tried the app on Lenovo Ideapad S10-T3, and the imagegestures app
> works fine otherwise, I get pan and pinch gestures.
>
> The MyGestureRecognizer::create(..) gets called once. I also disabled
> grabbing all other gestures:
> >>>>>>>>>>>
> //! [enable gestures]
> //    grabGesture(Qt::PanGesture);
> //    grabGesture(Qt::PinchGesture);
> //    grabGesture(Qt::SwipeGesture);
>    grabGesture(Qt::CustomGesture);
> //! [enable gestures]
> <<<<<<<<<<<<<
> No love, whatever I do. This all in the "imagestures" example app. The
> whole project is avaiable at
> http://www.4shared.com/file/NEetzicb/imagegestures.html
>
>
> On Mon, Jun 7, 2010 at 3:20 AM, Denis Dzyubenko <shadone at gmail.com> wrote:
> > single-touch device and touch are only sent as mouse events. Gestures
> > that come with Qt are touch-based, implemented using QTouchEvents, so
> > they wont work out of the box there.
>
> What I've understood is the MyGestureRecognizer should get a chance to
> evaluate every input event, to recognize gestures from stream of
> events. What is unclear to me is that what events are being passed to
> gesture recognizers? QTouchEvents where mentioned above. Are mouse
> events also passed to recognizers?
> If not, it will be impossible to use gestures on say X11 systems, that
> apparently provide only mouse events, and IMO this makes gestures
> pretty much useless. (devices providing touch events are not that
> common yet). Also, I dont see why we would not be able to recognize
> all gestures (other than QPinchGesture) from mouse events? Why it
> hasn't been implemented that way now? Definitely would be usefull if
> gestures would work from mouse events out-of-the-box, if developer
> wants to use them.
>
> Thanks,
> Carl
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20100809/f22aa069/attachment.html 


More information about the Qt-interest-old mailing list