[PyQt] [pyqt]how to reimplement qvalidator.validate() in api v2?

Han Jiang oglops at gmail.com
Mon Jul 29 11:09:17 BST 2013


The code works fine in api v1, if i uncomment the top sip calls, then it
means i'll be using v2, then of course i'll see errors like

TypeError: invalid result type from Validator.validate()

i know i need to change the return value of .validate() , but if i change
it to what pyqt doc says in v2 ,
http://pyqt.sourceforge.net/Docs/PyQt4/qvalidator.html#validate-2 ,it gives
me segmentation fault ( on pyqt 4.6.1, centos 6.3 x64). why?

v2 code works fine on pyqt 4.8 and 4.10 though ( tested on a fedora 19
linux and a windows 7 machine.) is this a bug or what am i missing ?

thanks !

http://pastebin.com/dDeZ52gZ



    #!/usr/bin/env python2

    # api v2
    import sip
    sip.setapi('QString', 2)
    sip.setapi('QVariant', 2)

    from PyQt4.QtGui import *
    from PyQt4.QtCore import *
    import re,os,sys

    class MyQComboBox(QComboBox):
        def __init__(self, parent=None, listing=None):
            super(MyQComboBox, self).__init__(parent)

            if listing != None:
                self.listSetup(listing)

        def listSetup(self, listing):
            self.setEditable(True)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20130729/0cc03348/attachment-0001.html>


More information about the PyQt mailing list