Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. [solved] QLineEdit, double VS maskedit!

[solved] QLineEdit, double VS maskedit!

Scheduled Pinned Locked Moved General and Desktop
8 Posts 2 Posters 2.5k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dcbasso
    wrote on last edited by
    #1

    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?

    Thanks!

    • I'm setting the text with this code:
      @
      ui->leTotal->setText(QString::number(value));
      @
    1 Reply Last reply
    0
    • D Offline
      D Offline
      dcbasso
      wrote on last edited by
      #2

      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!
      1 Reply Last reply
      0
      • EddyE Offline
        EddyE Offline
        Eddy
        wrote on last edited by
        #3

        Hi,

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

        Hope it helps

        Qt Certified Specialist
        www.edalsolutions.be

        1 Reply Last reply
        0
        • D Offline
          D Offline
          dcbasso
          wrote on last edited by
          #4

          I solve my second problem, solution THE MASK:

          @
          R$ 0000,00;9
          @

          But the first one I need some help...
          Thanks!

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dcbasso
            wrote on last edited by
            #5

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

            Thank you very much!

            1 Reply Last reply
            0
            • EddyE Offline
              EddyE Offline
              Eddy
              wrote on last edited by
              #6

              You're welcome.

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

              Happy coding!

              Qt Certified Specialist
              www.edalsolutions.be

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dcbasso
                wrote on last edited by
                #7

                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!

                Thanks

                1 Reply Last reply
                0
                • EddyE Offline
                  EddyE Offline
                  Eddy
                  wrote on last edited by
                  #8

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

                  Qt Certified Specialist
                  www.edalsolutions.be

                  1 Reply Last reply
                  0

                  • Login

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • Users
                  • Groups
                  • Search
                  • Get Qt Extensions
                  • Unsolved