Hi folks,

I had some problems with an unexpected return of the  
'QRegExpValidator.validate()' function.
Probably I just missed something, but I couldn’t find anything about it in the 
Bugzilla or elsewhere in the web yet.

I did a subclass of QSpinBox and implemented my own ‘validate()’ as described 
in the docs, several tutorials and postings.

regex = QtCore.QregExp(“[0-9]{1,2}”)
self.vali = QtGui.QRegExpValidator(regex,self)

def validate(self,text,pos):
    return self.vali.validate(text,pos)

But there was no effect while typing into the SpinBox.

I was expecting that validate() returns one of the described states:
QValidator.Invalid, QValidator.Intermediate, QValidator.Acceptable (0,1,2)

But in fact it comes back with something like
(0, u'0a', 2)
Which proves that the validator itself works fine. 
Only the return format is not accepted.
You’ll need to do something like

def validate(self,text,pos):
    return self.vali.validate(text,pos)[0]

to pass only the first entry back, then it works fine.

I didn’t try in Qt C++ only with PySide (beta1) but it looks like there is a 
mismatch somewhere between implementation and documentation or do I miss 
something here ?

BTW: Is there a way to search the mail archive somehow, something  like it is 
provided by the PySide Bugzilla ?

Cheers
Marco
_______________________________________________
PySide mailing list
[email protected]
http://lists.openbossa.org/listinfo/pyside

Reply via email to