[Qt-interest] QLineEdit with an InputMask: bug or feature?

John Posner jjposner at optimum.net
Mon Nov 23 20:48:29 CET 2009


[ I posted this on the PyQt forum yesterday, but got no response.  Could 
this be QTBUG-5050? (bugreports.qt.nokia.com) ]

Hi --

Environment: Win/XP SP3, Python 2.6.4, PyQt 4.6.2

I created a QLineEdit instance and set an input mask:

 self.setInputMask("0" * 10)

At runtime, after I click in the QLineEdit field, I can use the arrow 
keys to move left and right within a 10-character "span of emptiness". 
During such movements, QLineEdit.cursorPosition() returns values in the 
range 0..9, and QLineEdit.text() always returns an empty QString.

Is this the way QLineEdit is supposed to work? It makes for a confusing 
user experience. For example, after clicking near the right edge of the 
input field, the user cannot type any characters, presumably because 
QLineEdit.cursorPosition() returns 9 and the runtime thinks the field is 
already full.

Tx,
John




More information about the Qt-interest-old mailing list