[Resolved] QDoubleSpinBox : decimals disappear



  • 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.



  • The problem came from the Locale.

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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.