Calculator
By Tommi Piironen
Download source here.
Link to the course home page.
Program description: Calculator
Calculator, like the name implies, is a program for making calculations.
At this time the application is in early beta stage so only the most basic features are provided. Calculator can be used to compute simple arithmetic operations, such as addition, subtraction, multiplication and division.
Hacking
- The interface was done with QML. All the calculations are done with javascript.
C++ is basically only used to start up the program and to pass some data, such as the screen width and height, to the interface
- When the "="-button is pressed, the code calculates the given expression using javascripts eval()-function and prints the result. The expression it self is moved to the upper row and the result is displayed below it
- If user types two arithmetic operations consecutively, the first operator is replaced with the latter one. For example if user tries to type 6+-, the calculator replaces the expression with 6-