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. [Resolved] QDoubleSpinBox : decimals disappear

[Resolved] QDoubleSpinBox : decimals disappear

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 819 Views 1 Watching
  • 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.
  • B Offline
    B Offline
    Basch006
    wrote on last edited by
    #1

    Hi everybody !

    I got a problem with my QDoubleSpinBoxes. I use them in a QFormLayout (but I don't think it matters).
    Even with :
    @quantiteInSimple->setDecimals(2);
    quantiteInSimple->setRange(0.00, 100000.00);@
    I can get numbers higher than my maximum range with a "bug".

    When I write directly in the box "125.25", the result is ok.
    But, if I modify the value without writting all the number, in example I put a "4" juste before the dot, the result will be "125425" and not "1254.25" in the box. When I use this result, it will be "125425". So the dot doesn't just become "invisible", it disappears :/

    Something else is pretty strange. In this way, when I get "125425", with a step of "1.00", when I modify the value with the arrows, it will add "100" (like 1.00 without the dot) as if the dot/decimal was always existing. But, at the end, the result remains an integer.

    I really don't understand. My use of QDoubleSpinBox is basic, no modification at all. And I supposed that would nornormally be the correct behaviour of the class.
    Ideally, always have the dot (display, edit) would be perfect. And, in example, if the user doesn't type any decimals, the program automatically write "00" after the dot when the focus is out.

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Basch006
      wrote on last edited by
      #2

      The problem came from the Locale.

      I modified it to "French / France" and now it works perfectly ^^

      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