parsing of decimal in formula

Issue #177 closed
mischa krempel created an issue

Can not enter decimal number in formula.

On My Ubuntu ( german localization while my qtcreator has englisch localization) neither i.e. 3,4 (official german notation for decimals) nor 3.4 can be parsed.

Formulas from existing file work fine.

The debug console says:

Message: "Unexpected token ".4 " found at position 10." Expression: "Name_1 / 3.4 "

Formulas should accept only 3.4 notation (or both notations) in m.h.o.

Comments (4)

  1. Roman Telezhynskyi repo owner

    You can use point for decimal separator if you change settings. But it is not what we want. My solution is to catch all characters "." and "," and convert them to current locale settings, like do many programs.

  2. mischa krempel reporter


    result = Eval();


    qreal Calculator::EvalFormula(const QString &formula)

    triggers the error

    if I deselect With OS options (,) in preferences the 3,4 notation works. We should avoid a state where neither notation works as it is confusing for the user.

  3. Roman Telezhynskyi repo owner

    I think now fixed. User should choose what use "." or ",". Because we also want functions we can't allow both at the same time.

  4. Log in to comment