Unsolved How can I make QLineEdit paint a different text than the one assigned?
scastiello last edited by
I have a QLineEdit with a numerical validator ranging from -100 to 100. But I need the symbol "-" to be represented with the character "M".
I have already tried the following:
- Overwrite the text () method and do the replacement here. (It does not work)
- Override the displayText () method and put the setEchoMode (). (It does not work)
- Override the paintEvent () method. (Works, but does not look the same as any other QLineEdit)
Is there anything else I can do to get this effect?
Thanks all in advance.
m.sue last edited by m.sue
in case of a QSpinBox I did something similar by overriding the
QValidator::State validate(QString &input, int &pos) constfunction (changing numbers 1,2,... to characters A,B,...). So either you could use a QSpinBox instead of the QLineEdit or maybe it's possible to do the same thing using the
fixupmethod of a QValidator that you add to the QLineEdit.