[solved] QLineEdit, double VS maskedit!

  • Hi all!
    I try to find something on google, but I really not find something cool to use on my app!
    My problem is that I have a QLineEdit with this mask: "R$ 009,99", put when I set on double value, for example 12,34 , to the QLineEdit I got this: "R$ 12 ,34" and not "R$ 012,34" or "R$ 12,34".

    What can I do to solve this problem in easy way?


    • I'm setting the text with this code:

  • And I'm habing another problem now...

    The mask:
    R$ 0000,00;0

    When I type the value "R$ 0050,00" the field shows as needed, but when I do "ui->leTotal->text()" the return value is: R$ 5,00".
    When I type the value "R$ 0051,00" the field shows as needed, but when I do "ui->leTotal->text()" the return value is: R$ 51,00".
    I'm doing something wrong?
    I'm doing something wrong?

    Thanks all!

    • this masks really makes me crazy!

  • Hi,

    Try using 9 instead of 0.
    9 ASCII digit required. 0-9.
    0 ASCII digit permitted but not required.

    Hope it helps

  • I solve my second problem, solution THE MASK:

    R$ 0000,00;9

    But the first one I need some help...

  • Thanks Eddy, just now I see your answer.
    As I show here the change the 0 to 9 works fine!

    Thank you very much!

  • You're welcome.

    Could you please edit your first post and add [solved] to it.

    Happy coding!

  • Well My first doubt I don't solve, I make a Workaround to solve here, but I don't really think that the good and/or the right solution!
    But I will!


  • Could you make a new thread and elaborate on your first question. It's not clear to me what the problem is.

Log in to reply