[PyQt] Help with overriding validator and upper casing input

Rasha strasha at gmail.com
Wed Mar 18 08:41:04 GMT 2009


Hello. I'm new to PyQt, so dont be to hard on me. I need help with creating
a QRegExpValidator which would validate my input and would make it
uppercase.
I came up with this by browsing this list and searching the net and Qt
documentation, but it's not working.

class Validator(QtGui.QRegExpValidator):
     def __init__(self, parent=None):
        RegExp = QtCore.QRegExp('[A-Z]')
        QtGui.QRegExpValidator.__init__(self, RegExp, parent)


     def fixup(self, input):
        print 'fixup'
        input.replace(0,100,input.toUpper())

Fixup is not getting called... Why?

I have also tried a solution where I made a regular regexp validator and a
signal and slot which would make my input uppercase, but then that signal
overrides the validator.

What is the proper way to achieve this?

Regards,
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090318/1da1fb68/attachment.html


More information about the PyQt mailing list