[PyQt] pyuic : backslash escaping with untranslatable strings

Felix Schmidt fschmidt at bihl-wiedemann.de
Tue Nov 3 11:02:46 GMT 2009

I got the following bug (or Feature?) in pyuic :

With Qt Designer I created a QLineEdit with inputMask set to 
"\0\x>HHHH;_" (to input a hex-value like "0x12AB").
So far it's fine.
But when I uncheck the "translatable" flag of this inputMask (don't want 
it to be translated in any language),
pyuic doesn't escape the backslashes anymore.
I get a "ValueError: invalid \x escape" on line
 > self.linHexcode.setInputMask("\0\x>HHHH;_")

With the translatable Flag set again, pyuic correctly generates a
"\\0\\x>HHHH;_", None, QtGui.QApplication.UnicodeUTF8))

With other string properties (instead of "inputMask") it's the same thing.

Is there any way to get this fixed? (Of course, i can just ignore this 
string in Linguist, but its not the neat solution. Manually escape the 
string in Qt Designer isn't either.)

Felix Schmidt

Python 2.6
Qt 4.5.3
PyQt 4.6
sip 4.9

More information about the PyQt mailing list