Solved QLineedit cursor jumps right in hex input
-
Hi
I need to have a Qlineedit that accepts six hexadecimal digits as input like that:
"FF3ABD".
I simply used:setInputMask("HHHHHH");
for that. The problem is if I enter the first digit the cursor jumps into an rightmost empty field which seems to be not part of my input mask.
Why is that so and can this be changed to let the cursor simply jump the the next right field?
-
I think I solved it by using a QValidator instead of inputMask:
le = new QLineEdit(this); QRegExp rx("([0-9]|[A-F]|[a-f]){6}"); QValidator *valid = new QRegExpValidator(rx,this); le->setValidator(valid);
and to always get uppercase chars when typing I added this:
connect(le,&QLineEdit::textChanged,this,&mainwindow::textEdited); ... void mainwindow::textEdited(const QString &arg1) { le->setText(arg1.toUpper()); }