Skip to content

Add display for user's input

Add display to keep the user's entries visible during the whole calculation process, this allows editing the expression at any point to make any correction the user considers opportune. This display allows coping/pasting an expression to be calculated, that can also be edited as required.

All currently implemented functions are supported and also was added support for 0x, 0b and 0 as prefixes for hex, binary and octal numbers.

Before:image.png

After:

image.pngimage.png

New classes added:

  • KCalcToken: contains a given valid token such as an operation (+, -, ...), a function (cos, ln, ...), a parenthesis or a number.
  • KCalcParser: provides an API to convert a given string (for example "1+cos(4.5)") to a Queue of KCalcToken objects.
  • KCalcInputDisplay: this is a customized QLineEdit widget, it holds the user's input.
  • KCalcDisplayFrame: holds the input display, result display and some labels.
  • CalcEngine_p: encapsulates the functionality that used to be available in CalcEngine class, to be only visible for KCalcToken objects.

Modified classes:

  • CalcEngine: added the main algorithm to process the calculation, based on common Operator-precedence parsers.

@teams/qa @teams/vdg @teams/usability

FEATURE: 461010 FEATURE: 470371 FEATURE: 470591 FEATURE: 142728 FEATURE: 459999 FEATURE: 443276 CCBUG: 447347 BUG: 454835

Edited by Gabriel Barrantes

Merge request reports