[PyQt] QLineEdit with an InputMask: bug or feature?

John Posner jjposner at optimum.net
Tue Nov 24 23:35:56 GMT 2009

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.


View this message in context: http://old.nabble.com/QLineEdit-with-an-InputMask%3A-bug-or-feature--tp26466393p26466393.html
Sent from the PyQt mailing list archive at Nabble.com.

More information about the PyQt mailing list