Nominate our 2022 Qt Champions!

Right aligned QLineEdit with an input mask: looks weird

  • Hi,

    I am trying to create a line edit that only accepts digits, and that should be right aligned. In theory, this is easy: set an appropriate input mask, and set the aligment to right. Problem is, that alignment does not seem to work when a mask has been set. I did not see that limitation mentioned in the documentation.

    The input mask I tried to use was "#9999999990;"

    Am I overlooking something trivial here?

    Edit: I know that QSpinBox does work, but that is not the question here.

  • I think "QwwLineEdit": does that. But i'm not sure.

  • Did you try use Qt::AlignAbsolute flag?

Log in to reply