QLineedit cursor jumps right in hex input

  • Hi

    I need to have a Qlineedit that accepts six hexadecimal digits as input like that:
    I simply used:


    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.

    Peek 2021-04-23 16-06.gif

    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);

    and to always get uppercase chars when typing I added this:

    void mainwindow::textEdited(const QString &arg1)

    Peek 2021-04-24 08-59.gif

Log in to reply