[prev in list] [next in list] [prev in thread] [next in thread]
List: pykde
Subject: [PyQt] [pyqt]how to reimplement qvalidator.validate() in api v2?
From: Han Jiang <oglops () gmail ! com>
Date: 2013-07-29 10:09:17
Message-ID: CAPiRsUWZbcmJHj3UUr-0kf13X6rwXB6cJg9ox2T+ud2a_KQATg () mail ! gmail ! com
[Download RAW message or body]
[Attachment #2 (multipart/alternative)]
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)
[Attachment #5 (text/html)]
<div dir="ltr"><p>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</p>
<p><code>TypeError: invalid result type from Validator.validate()</code></p>
<p>i know i need to change the return value of .validate() , but if i change it to \
what pyqt doc says in v2 , <a \
href="http://pyqt.sourceforge.net/Docs/PyQt4/qvalidator.html#validate-2" \
rel="nofollow">http://pyqt.sourceforge.net/Docs/PyQt4/qvalidator.html#validate-2</a> \
,it gives me segmentation fault ( on pyqt 4.6.1, centos 6.3 x64). why?</p>
<p>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 ?</p>
<p>thanks !</p>
<pre style class=""><code><span class=""><a \
href="http://pastebin.com/dDeZ52gZ">http://pastebin.com/dDeZ52gZ</a><br> <br><br><br> \
#!/usr/bin/env python2<br> <br> # api v2<br> import sip<br> \
sip.setapi('QString', 2)<br> sip.setapi('QVariant', 2)<br> <br> \
from PyQt4.QtGui import *<br> from PyQt4.QtCore import *<br> import \
re,os,sys<br> <br> class MyQComboBox(QComboBox):<br> def __init__(self, \
parent=None, listing=None):<br> super(MyQComboBox, self).__init__(parent)<br> \
<br> if listing != None:<br> self.listSetup(listing)<br> \
<br> def listSetup(self, listing):<br> self.setEditable(True)<br> \
</span></code></pre></div>
_______________________________________________
PyQt mailing list PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic