[Sloved]question about QGesture's malloc.
In Qt4.8.4, QGesture has several derived class, each of them represent a single gesture.
So, for a QWidget, if it support 3 kinds of gesture, There should be 3 deferent instances of QGesture is created(with different sub class)?
QGesture events are created by Qt underlying gesture system itself, and can be handled in the QWidget::event method. So you don't have to create those objects. To handle them you have to subclass QWidget (or a derivated class) and reimplement the event method. You could also use an event filter to catch the event.
Use grabGesture method to tell Qt you want to handle Gesture events.
Have a look at gesture handling "Here":http://doc.qt.digia.com/main-snapshot/gestures-overview.html
The QGesture is essentially an object that is kept around to store info in.
The amount of QGesture instances is equal to the amount of gestures you grab, times the amount of widgets you do this on.
Notice that Qt handles this object, and deletes it properly for you at the end of the application.
thanks, you are both right.
the QGesture object is allocated when grabGesture() is called.