[Qt-interest] QMultiGestureRecognizer
Sean T. Hayes
sean.t.hayes at vanderbilt.edu
Tue Apr 26 21:22:45 CEST 2011
On Fri, Apr 22, 2011 at 7:11 AM, Wathek LOUED <wathek at gmail.com> wrote:
> I was thinking of a class QMultiGestureRecognizer that will recognize
> multiple same gestures that are happening on a same QObject. How would you
> imagine that ?
>
I do not think that is possible unless all the gestures represented with a
single subclass of QGesture. If the gestures had similar fields that could
work well. You could have a Type enum that could be returned to let you know
what type of gesture is being received. That kind of setup would be similar
to the QEvent class. Many types of QEvents do not subclass QEvent. Instead
they are just created with a unique type.
If you want to have different subclasses of QGesture, I cannot think of a
way of using Qt's gesture management without registering
a separate QGestureRecognizer for each type.
However, you may be able to make your own gesture recognition system. Create
a gesture recognizer class that is installed as an event filter on the
objects you are interested in. Then within the eventFilter(QObject *object,
QEvent *event) method, you could create and update a gesture similar to
QGestureRecognizer::recognize(). The only trick would be figuring out how to
maintain a single gesture over multiple events. You would probably use a
hash of active gesture objects were the key was the pointer to the target
QObject. I have considered doing something similar my self.
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20110426/d9c53007/attachment.html
More information about the Qt-interest-old
mailing list