[PyQt] Gesture programming in PyQt

Detlev Offenbach detlev at die-offenbachs.de
Thu Jan 5 14:00:39 GMT 2012


Am 04.01.2012 um 20:04 schrieb Phil Thompson:

> On Wed, 4 Jan 2012 19:46:45 +0100, Detlev Offenbach
> <detlev at die-offenbachs.de> wrote:
>> Hello,
>> 
>> does anybody have experience in gesture programming with PyQt? I am
> trying
>> to program a custom gesture recognizer, but registering it with
>> QGestureRecognizer.registerRecognizer(…) crashes the script. Here is the
>> excerpt of the code that is executing the above function.
>> 
>> --CODE--
>> class E5SwipeGestureRecognizer(QGestureRecognizer):
>>   __type = 0
>>   __instance = None
>> 
>>   def __init__(self):
>>       super().__init__()
>> 
>>   @classmethod
>>   def gestureType(cls):
>>       if cls.__instance is None:
>>           cls.__instance = E5SwipeGestureRecognizer()
>>           cls.__type =
>>           QGestureRecognizer.registerRecognizer(cls.__instance)   # this segfaults the app
>>       return cls.__type
>> --END CODE--
> 
> Hmm - the /Transfer/ annotation on QGestureRecognizer.create() looks
> wrong. Try changing it to /Factory/.


That might be a second issue. So far my code didn't even get there. The call to register my gesture recognizer already crashes the application (see above). That is long before the recognizer is asked to create a new gesture object.

Regards
Detlev

Detlev Offenbach
detlev at die-offenbachs.de



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 455 bytes
Desc: Message signed with OpenPGP using GPGMail
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20120105/f6e85e7d/attachment.pgp>


More information about the PyQt mailing list