Merge lp:~rpadovani/ubuntu-calculator-app/keyboardImprovement into lp:ubuntu-calculator-app

Proposed by Riccardo Padovani
Status: Merged
Merged at revision: 5
Proposed branch: lp:~rpadovani/ubuntu-calculator-app/keyboardImprovement
Merge into: lp:ubuntu-calculator-app
Prerequisite: lp:~rpadovani/ubuntu-calculator-app/cleanUp
Diff against target: 934 lines (+411/-481)
2 files modified
app/ubuntu-calculator-app.qml (+1/-1)
app/ui/CalcKeyboard.qml (+410/-480)
To merge this branch: bzr merge lp:~rpadovani/ubuntu-calculator-app/keyboardImprovement
Reviewer Review Type Date Requested Status
Bartosz Kosiorek Approve
Review via email: mp+242887@code.launchpad.net

Commit message

Added swype to advanced functions and support for them

Description of the change

Added swype to advanced functions and support for them

To post a comment you must log in.
6. By Riccardo Padovani

Updated copyright

Revision history for this message
Bartosz Kosiorek (gang65) wrote :

Looks ok

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'app/ubuntu-calculator-app.qml'
--- app/ubuntu-calculator-app.qml 2014-11-26 09:41:07 +0000
+++ app/ubuntu-calculator-app.qml 2014-11-26 09:41:07 +0000
@@ -42,7 +42,7 @@
4242
43 function calculate() {43 function calculate() {
44 console.log("Formula: " + formula)44 console.log("Formula: " + formula)
45 var result = MathJs.eval(formula);45 var result = mathJs.eval(formula);
46 result = result.toString();46 result = result.toString();
47 console.log("Result: " + result);47 console.log("Result: " + result);
48 formula = '';48 formula = '';
4949
=== modified file 'app/ui/CalcKeyboard.qml'
--- app/ui/CalcKeyboard.qml 2014-11-26 09:41:07 +0000
+++ app/ui/CalcKeyboard.qml 2014-11-26 09:41:07 +0000
@@ -1,13 +1,13 @@
1/*1/*
2 * Copyright 2014 Canonical Ltd.2 * Copyright (C) 2014 Canonical Ltd
3 *3 *
4 * This file is part of ubuntu-calculator-app.4 * This file is part of Ubuntu Calculator App
5 *5 *
6 * ubuntu-calculator-app is free software; you can redistribute it and/or modify6 * Ubuntu Calculator App is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by7 * it under the terms of the GNU General Public License version 3 as
8 * the Free Software Foundation; version 3.8 * published by the Free Software Foundation.
9 *9 *
10 * ubuntu-calculator-app is distributed in the hope that it will be useful,10 * Ubuntu Calculator App is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.13 * GNU General Public License for more details.
@@ -15,14 +15,13 @@
15 * You should have received a copy of the GNU General Public License15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */17 */
18
19import QtQuick 2.318import QtQuick 2.3
20import Ubuntu.Components 1.119import Ubuntu.Components 1.1
2120
22Item {21Item {
23 id: virtualKeyboard22 id: virtualKeyboard
24 width: parent.width23 width: parent.width
25 height: parent.height / 224 height: grid.height+units.gu(2)
2625
27 property int calcGridUnit: width / 5026 property int calcGridUnit: width / 50
28 property variant keyboardButtons: {'0': zeroButton,27 property variant keyboardButtons: {'0': zeroButton,
@@ -51,478 +50,409 @@
51 'clear': clearButton,50 'clear': clearButton,
52 'backspace': backspaceButton }51 'backspace': backspaceButton }
5352
54 Rectangle {53 Flickable {
55 width: virtualKeyboard.width * 254 id: flickableKeyboard
56 height: grid.height + units.gu(2)55 anchors.fill: parent
57 color: "#ffffff"56 flickableDirection: Flickable.HorizontalFlick
57 contentWidth: virtualKeyboard.width * 2
58 contentHeight: grid.height + units.gu(4)
59 boundsBehavior: Flickable.DragOverBounds
5860
59 anchors{61 onMovementEnded: {
60 top: parent.top62 // if we are not on the border of the virtual calculator keyboard
61 topMargin: formulaView.__wasAtYBegining & formulaView.__displaceDist > 0 ? formulaView.__displaceDist : 063 // then trigger flick
64 if (!flickableKeyboard.atXBeginning && !flickableKeyboard.atXEnd) {
65 if (contentX < virtualKeyboard.width / 2) {
66 flickableKeyboard.flick( units.gu(200), 0);
67 } else {
68 flickableKeyboard.flick( -units.gu(200), 0);
69 }
70 }
62 }71 }
6372
64 Item {73 Rectangle {
65 id: grid74 width: virtualKeyboard.width * 2
6675 height: grid.height + units.gu(2)
67 // 8 keys and 7 space between and border76 color: "#ffffff"
68 width: (calcGridUnit*12)*8 + (calcGridUnit)*7 + calcGridUnit77
69 height: (calcGridUnit*9)*5 + (calcGridUnit)*478 Item {
7079 id: grid
71 anchors{80
72 horizontalCenter: parent.horizontalCenter81 // 8 keys and 7 space between and border
73 top: parent.top82 width: (calcGridUnit*12)*8 + (calcGridUnit)*7 + calcGridUnit
74 topMargin: units.gu(1)83 height: (calcGridUnit*9)*5 + (calcGridUnit)*4
75 }84
7685 anchors{
77 KeyboardButton {86 horizontalCenter: parent.horizontalCenter
78 objectName: "clearButton"87 top: parent.top
79 id: clearButton88 topMargin: units.gu(1)
80 x: 089 }
81 y: 090
82 // TRANSLATORS: Refers to Clear, keep the translation to 2 characters91 KeyboardButton {
83 text: i18n.tr("←")92 objectName: "clearButton"
84 onReleased: {93 id: clearButton
85 numeralPop();94 x: 0
8695 y: 0
87 }96 // TRANSLATORS: Refers to Clear, keep the translation to 2 characters
88 }97 text: i18n.tr("←")
8998 // TODO: implement function to remove last char
90 KeyboardButton {99 // onReleased: numeralPop();
91 objectName: "signButton"100 }
92 id: signButton101
93 x: (calcGridUnit*13)102 KeyboardButton {
94 y: 0103 objectName: "signButton"
95 text: "+/-"104 id: signButton
96 onReleased: {105 x: (calcGridUnit*13)
97 changeSign();106 y: 0
98 }107 text: "+/-"
99 }108 // TODO: implement changeSign function
100109 // onReleased: changeSign();
101 KeyboardButton {110 }
102 objectName: "divideButton"111
103 id: divideButton112 KeyboardButton {
104 x: (calcGridUnit*13)*2113 objectName: "divideButton"
105 y: 0114 id: divideButton
106 text: "÷"115 x: (calcGridUnit*13)*2
107 onReleased: {116 y: 0
108 formulaPush('/');117 text: "÷"
109118 onReleased: formulaPush('/');
110 }119 }
111 }120
112121 KeyboardButton {
113 KeyboardButton {122 objectName: "multiplyButton"
114 objectName: "multiplyButton"123 id: multiplyButton
115 id: multiplyButton124 x: (calcGridUnit*13)*3
116 x: (calcGridUnit*13)*3125 y: 0
117 y: 0126 text: "×"
118 text: "×"127 onReleased: formulaPush('*');
119 onReleased: {128 }
120 formulaPush('*');129
121130 KeyboardButton {
122 }131 objectName: "powerButton"
123 }132 id: powerButton
124133 x: (calcGridUnit*13)*4 + calcGridUnit
125 KeyboardButton {134 y: 0
126 objectName: "powerButton"135 text: "xⁿ"
127 id: powerButton136 onReleased: formulaPush('^');
128 x: (calcGridUnit*13)*4 + calcGridUnit137 }
129 y: 0138
130 text: "xⁿ"139
131 onReleased: {140 KeyboardButton {
132 formulaPush('^');141 objectName: "squareButton"
133 }142 id: squareButton
134 }143 x: (calcGridUnit*13)*5 + calcGridUnit
135144 y: 0
136145 text: "x²"
137 KeyboardButton {146 onReleased: {
138 objectName: "squareButton"147 if (formulaPush('^') === true) {
139 id: squareButton148 formulaPush('2')
140 x: (calcGridUnit*13)*5 + calcGridUnit149 }
141 y: 0150 }
142 text: "x²"151 }
143 onReleased: {152
144 if (formulaPush('^') === true) {153 KeyboardButton {
145 hasToAddDot = true154 objectName: "cubeButton"
146 formulaPush('2')155 id: cubeButton
147 }156 x: (calcGridUnit*13)*6 + calcGridUnit
148 }157 y: 0
149 }158 text: "x³"
150159 onReleased: {
151 KeyboardButton {160 if (formulaPush('^') === true) {
152 objectName: "cubeButton"161 formulaPush('3')
153 id: cubeButton162 }
154 x: (calcGridUnit*13)*6 + calcGridUnit163 }
155 y: 0164 }
156 text: "x³"165
157 onReleased: {166 KeyboardButton {
158 if (formulaPush('^') === true) {167 objectName: "backspaceButton"
159 //make sure that we have integers (to avoid expressions like 2^2.1)168 id: backspaceButton
160 hasToAddDot = true169 x: (calcGridUnit*13)*7 + calcGridUnit
161 formulaPush('3')170 y: 0
162 }171 text: "←"
163 }172 // TODO: implement function to delete last char
164 }173 // onReleased: numeralPop();
165174 }
166 KeyboardButton {175
167 objectName: "backspaceButton"176 KeyboardButton {
168 id: backspaceButton177 objectName: "sevenButton"
169 x: (calcGridUnit*13)*7 + calcGridUnit178 id: sevenButton
170 y: 0179 x: 0
171 text: "←"180 y: (calcGridUnit*10)
172 onReleased: {181 text: Number(7).toLocaleString(Qt.locale(), "f", 0)
173 numeralPop();182 onReleased: formulaPush(text);
174 }183 }
175 }184
176185 KeyboardButton {
177 KeyboardButton {186 objectName: "eightButton"
178 objectName: "sevenButton"187 id: eightButton
179 id: sevenButton188 x: (calcGridUnit*13)
180 x: 0189 y: (calcGridUnit*10)
181 y: (calcGridUnit*10)190 text: Number(8).toLocaleString(Qt.locale(), "f", 0)
182 text: Number(7).toLocaleString(Qt.locale(), "f", 0)191 onReleased: formulaPush(text);
183 onReleased: {192 }
184 formulaPush(text);193
185 }194 KeyboardButton {
186 }195 objectName: "nineButton"
187196 id: nineButton
188 KeyboardButton {197 x: (calcGridUnit*13)*2
189 objectName: "eightButton"198 y: (calcGridUnit*10)
190 id: eightButton199 text: Number(9).toLocaleString(Qt.locale(), "f", 0)
191 x: (calcGridUnit*13)200 onReleased: formulaPush(text);
192 y: (calcGridUnit*10)201 }
193 text: Number(8).toLocaleString(Qt.locale(), "f", 0)202
194 onReleased: {203 KeyboardButton {
195 formulaPush(text);204 objectName: "minusButton"
196 }205 id: minusButton
197 }206 x: (calcGridUnit*13)*3
198207 y: (calcGridUnit*10)
199 KeyboardButton {208 text: "−"
200 objectName: "nineButton"209 onReleased: formulaPush('-');
201 id: nineButton210 }
202 x: (calcGridUnit*13)*2211
203 y: (calcGridUnit*10)212 KeyboardButton {
204 text: Number(9).toLocaleString(Qt.locale(), "f", 0)213 objectName: "eNumberButton"
205 onReleased: {214 id: eNumberButton
206 formulaPush(text);215 x: (calcGridUnit*13)*4 + calcGridUnit
207 }216 y: (calcGridUnit*10)
208 }217 text: "e"
209218 onReleased: formulaPush('E');
210 KeyboardButton {219 }
211 objectName: "minusButton"220
212 id: minusButton221 KeyboardButton {
213 x: (calcGridUnit*13)*3222 objectName: "piNumberButton"
214 y: (calcGridUnit*10)223 id: piNumberButton
215 text: "−"224 x: (calcGridUnit*13)*5 + calcGridUnit
216 onReleased: {225 y: (calcGridUnit*10)
217 formulaPush('-');226 text: "π"
218227 onReleased: formulaPush('pi');
219 }228 }
220 }229
221230 KeyboardButton {
222231 objectName: "moduloButton"
223 KeyboardButton {232 id: moduloButton
224 objectName: "eNumberButton"233 x: (calcGridUnit*13)*6 + calcGridUnit
225 id: eNumberButton234 y: (calcGridUnit*10)
226 x: (calcGridUnit*13)*4 + calcGridUnit235 // TRANSLATORS: Refers to Modulo - operation that finds the remainder of division of one number by another.
227 y: (calcGridUnit*10)236 text: i18n.tr("mod")
228 text: "e"237 onReleased: formulaPush('%');
229 onReleased: {238 }
230 formulaPush('E');239
231240 KeyboardButton {
232 }241 objectName: "factorialNumberButton"
233 }242 id: factorialNumberButton
234243 x: (calcGridUnit*13)*7 + calcGridUnit
235 KeyboardButton {244 y: (calcGridUnit*10)
236 objectName: "piNumberButton"245 text: "!"
237 id: piNumberButton246 onReleased: formulaPush('!');
238 x: (calcGridUnit*13)*5 + calcGridUnit247 }
239 y: (calcGridUnit*10)248
240 text: "π"249 KeyboardButton {
241 onReleased: {250 objectName: "fourButton"
242 formulaPush('pi');251 id: fourButton
243252 x: 0
244 }253 y: (calcGridUnit*10)*2
245 }254 text: Number(4).toLocaleString(Qt.locale(), "f", 0)
246255 onReleased: formulaPush(text);
247 KeyboardButton {256 }
248 objectName: "moduloButton"257
249 id: moduloButton258 KeyboardButton {
250 x: (calcGridUnit*13)*6 + calcGridUnit259 objectName: "fiveButton"
251 y: (calcGridUnit*10)260 id: fiveButton
252 // TRANSLATORS: Refers to Modulo - operation that finds the remainder of division of one number by another.261 x: (calcGridUnit*13)
253 text: i18n.tr("mod")262 y: (calcGridUnit*10)*2
254 onReleased: {263 text: Number(5).toLocaleString(Qt.locale(), "f", 0)
255 formulaPush('%');264 onReleased: formulaPush(text);
256265 }
257 }266
258 }267 KeyboardButton {
259268 objectName: "sixButton"
260 KeyboardButton {269 id: sixButton
261 objectName: "factorialNumberButton"270 x: (calcGridUnit*13)*2
262 id: factorialNumberButton271 y: (calcGridUnit*10)*2
263 x: (calcGridUnit*13)*7 + calcGridUnit272 text: Number(6).toLocaleString(Qt.locale(), "f", 0)
264 y: (calcGridUnit*10)273 onReleased: formulaPush(text);
265 text: "!"274 }
266 onReleased: {275
267 formulaPush('!');276 KeyboardButton {
268277 objectName: "plusButton"
269 }278 id: plusButton
270 }279 x: (calcGridUnit*13)*3
271280 y: (calcGridUnit*10)*2
272 KeyboardButton {281 text: "+"
273 objectName: "fourButton"282 onReleased: formulaPush(text);
274 id: fourButton283 }
275 x: 0284
276 y: (calcGridUnit*10)*2285 KeyboardButton {
277 text: Number(4).toLocaleString(Qt.locale(), "f", 0)286 objectName: "openBracketButton"
278 onReleased: {287 id: openBracketButton
279 formulaPush(text);288 x: (calcGridUnit*13)*4 + calcGridUnit
280 }289 y: (calcGridUnit*10)*2
281 }290 text: "("
282291 onReleased: formulaPush('(');
283 KeyboardButton {292 }
284 objectName: "fiveButton"293
285 id: fiveButton294 KeyboardButton {
286 x: (calcGridUnit*13)295 objectName: "closeBracketButton"
287 y: (calcGridUnit*10)*2296 id: closeBracketButton
288 text: Number(5).toLocaleString(Qt.locale(), "f", 0)297 x: (calcGridUnit*13)*5 + calcGridUnit
289 onReleased: {298 y: (calcGridUnit*10)*2
290 formulaPush(text);299 text: ")"
291 }300 onReleased: formulaPush(')');
292 }301 }
293302
294 KeyboardButton {303 KeyboardButton {
295 objectName: "sixButton"304 objectName: "multiplicativeInverseButton"
296 id: sixButton305 id: multiplicativeInverseButton
297 x: (calcGridUnit*13)*2306 x: (calcGridUnit*13)*6 + calcGridUnit
298 y: (calcGridUnit*10)*2307 y: (calcGridUnit*10)*2
299 text: Number(6).toLocaleString(Qt.locale(), "f", 0)308 text: "1/x"
300 onReleased: {309 onReleased: {
301 formulaPush(text);310 if (formulaPush('^') === true) {
302 }311 formulaPush('-1')
303 }312 }
304313 }
305 KeyboardButton {314 }
306 objectName: "plusButton"315
307 id: plusButton316 KeyboardButton {
308 x: (calcGridUnit*13)*3317 objectName: "multiplicativeInverseButton2"
309 y: (calcGridUnit*10)*2318 id: multiplicativeInverseButton2
310 text: "+"319 x: (calcGridUnit*13)*7 + calcGridUnit
311 onReleased: {320 y: (calcGridUnit*10)*2
312 formulaPush(text);321 text: "1/x²"
313322 onReleased: {
314 }323 if (formulaPush('^') === true) {
315 }324 formulaPush('-2')
316325 }
317 KeyboardButton {326 }
318 objectName: "openBracketButton"327 }
319 id: openBracketButton328
320 x: (calcGridUnit*13)*4 + calcGridUnit329 KeyboardButton {
321 y: (calcGridUnit*10)*2330 objectName: "oneButton"
322 text: "("331 id: oneButton
323 onReleased: {332 x: 0
324 formulaPush('(');333 y: (calcGridUnit*10)*3
325334 text: Number(1).toLocaleString(Qt.locale(), "f", 0)
326 }335 onReleased: formulaPush(text);
327 }336 }
328337
329 KeyboardButton {338 KeyboardButton {
330 objectName: "closeBracketButton"339 objectName: "twoButton"
331 id: closeBracketButton340 id: twoButton
332 x: (calcGridUnit*13)*5 + calcGridUnit341 x: (calcGridUnit*13)
333 y: (calcGridUnit*10)*2342 y: (calcGridUnit*10)*3
334 text: ")"343 text: Number(2).toLocaleString(Qt.locale(), "f", 0)
335 onReleased: {344 onReleased: formulaPush(text);
336 formulaPush(')');345 }
337346
338 }347 KeyboardButton {
339 }348 objectName: "threeButton"
340349 id: threeButton
341 KeyboardButton {350 x: (calcGridUnit*13)*2
342 objectName: "multiplicativeInverseButton"351 y: (calcGridUnit*10)*3
343 id: multiplicativeInverseButton352 text: Number(3).toLocaleString(Qt.locale(), "f", 0)
344 x: (calcGridUnit*13)*6 + calcGridUnit353 onReleased: formulaPush(text);
345 y: (calcGridUnit*10)*2354 }
346 text: "1/x"355
347 onReleased: {356 KeyboardButton {
348 if (formulaPush('^') === true) {357 objectName: "equalsButton"
349 //make sure that we have integers (to avoid expressions like 2^2.1)358 id: equalsButton
350 hasToAddDot = true359 x: (calcGridUnit*13)*3
351 formulaPush('-1')360 y: (calcGridUnit*10)*3
352 }361 height: (calcGridUnit*19)
353 }362 text: "="
354 }363 onReleased: calculate();
355364 }
356 KeyboardButton {365
357 objectName: "multiplicativeInverseButton2"366 KeyboardButton {
358 id: multiplicativeInverseButton2367 objectName: "sqrtButton"
359 x: (calcGridUnit*13)*7 + calcGridUnit368 id: sqrtButton
360 y: (calcGridUnit*10)*2369 x: (calcGridUnit*13)*4 + calcGridUnit
361 text: "1/x²"370 y: (calcGridUnit*10)*3
362 onReleased: {371 text: "√ "
363 if (formulaPush('^') === true) {372 onReleased: formulaPush('sqrt(')
364 //make sure that we have integers (to avoid expressions like 2^2.1)373 }
365 hasToAddDot = true374
366 formulaPush('-2')375 KeyboardButton {
367 }376 objectName: "cosinusButton2"
368 }377 id: cosinusButton2
369 }378 x: (calcGridUnit*13)*5 + calcGridUnit
370379 y: (calcGridUnit*10)*3
371 KeyboardButton {380 text: "cos"
372 objectName: "oneButton"381 onReleased: formulaPush('cos(')
373 id: oneButton382 }
374 x: 0383
375 y: (calcGridUnit*10)*3384 KeyboardButton {
376 text: Number(1).toLocaleString(Qt.locale(), "f", 0)385 objectName: "tangensButton2"
377 onReleased: {386 id: tangensButton2
378 formulaPush(text);387 x: (calcGridUnit*13)*6 + calcGridUnit
379 }388 y: (calcGridUnit*10)*3
380 }389 text: "tan"
381390 onReleased: formulaPush('tan(')
382 KeyboardButton {391 }
383 objectName: "twoButton"392
384 id: twoButton393 KeyboardButton {
385 x: (calcGridUnit*13)394 objectName: "cotangensButton2"
386 y: (calcGridUnit*10)*3395 id: cotangensButton2
387 text: Number(2).toLocaleString(Qt.locale(), "f", 0)396 x: (calcGridUnit*13)*7 + calcGridUnit
388 onReleased: {397 y: (calcGridUnit*10)*3
389 formulaPush(text);398 text: "ctg"
390 }399 onReleased: formulaPush('atan(')
391 }400 }
392401
393 KeyboardButton {402 KeyboardButton {
394 objectName: "threeButton"403 objectName: "zeroButton"
395 id: threeButton404 id: zeroButton
396 x: (calcGridUnit*13)*2405 x: 0
397 y: (calcGridUnit*10)*3406 y: (calcGridUnit*10)*4
398 text: Number(3).toLocaleString(Qt.locale(), "f", 0)407 width: (calcGridUnit*12)*2+calcGridUnit
399 onReleased: {408 text: Number(0).toLocaleString(Qt.locale(), "f", 0)
400 formulaPush(text);409 onReleased: formulaPush(text);
401 }410 }
402 }411
403412 KeyboardButton {
404 KeyboardButton {413 objectName: "pointButton"
405 objectName: "equalsButton"414 id: pointButton
406 id: equalsButton415 x: (calcGridUnit*13)*2
407 x: (calcGridUnit*13)*3416 y: (calcGridUnit*10)*4
408 y: (calcGridUnit*10)*3417 text: "."
409 height: (calcGridUnit*19)418 // TODO: check if there isn't already a dot in the calc
410 text: "="419 onReleased: formulaPush('.');
411 onReleased: {420 }
412 calculate();421
413422 KeyboardButton {
414 }423 objectName: "sinusButton"
415 }424 id: sinusButton
416425 x: (calcGridUnit*13)*4 + calcGridUnit
417 KeyboardButton {426 y: (calcGridUnit*10)*4
418 objectName: "sqrtButton"427 text: "sin"
419 id: sqrtButton428 onReleased: formulaPush('sin(')
420 x: (calcGridUnit*13)*4 + calcGridUnit429 }
421 y: (calcGridUnit*10)*3430
422 text: "√ "431 KeyboardButton {
423 onReleased: {432 objectName: "cosinusButton"
424 formulaPush('sqrt(')433 id: cosinusButton
425 hasToAddDot = true434 x: (calcGridUnit*13)*5 + calcGridUnit
426 }435 y: (calcGridUnit*10)*4
427 }436 text: "cos"
428437 onReleased: formulaPush('cos(')
429 KeyboardButton {438 }
430 objectName: "cosinusButton2"439
431 id: cosinusButton2440 KeyboardButton {
432 x: (calcGridUnit*13)*5 + calcGridUnit441 objectName: "tangensButton"
433 y: (calcGridUnit*10)*3442 id: tangensButton
434 text: "cos"443 x: (calcGridUnit*13)*6 + calcGridUnit
435 onReleased: {444 y: (calcGridUnit*10)*4
436 formulaPush('cos(')445 text: "tan"
437 hasToAddDot = true446 onReleased: formulaPush('tan(')
438 }447 }
439 }448
440449 KeyboardButton {
441 KeyboardButton {450 objectName: "cotangensButton"
442 objectName: "tangensButton2"451 id: cotangensButton
443 id: tangensButton2452 x: (calcGridUnit*13)*7 + calcGridUnit
444 x: (calcGridUnit*13)*6 + calcGridUnit453 y: (calcGridUnit*10)*4
445 y: (calcGridUnit*10)*3454 text: "ctg"
446 text: "tan"455 onReleased: formulaPush('atan(')
447 onReleased: {
448 formulaPush('tan(')
449 hasToAddDot = true
450 }
451 }
452
453 KeyboardButton {
454 objectName: "cotangensButton2"
455 id: cotangensButton2
456 x: (calcGridUnit*13)*7 + calcGridUnit
457 y: (calcGridUnit*10)*3
458 text: "ctg"
459 onReleased: {
460 formulaPush('atan(')
461 hasToAddDot = true
462 }
463 }
464
465 KeyboardButton {
466 objectName: "zeroButton"
467 id: zeroButton
468 x: 0
469 y: (calcGridUnit*10)*4
470 width: (calcGridUnit*12)*2+calcGridUnit
471 text: Number(0).toLocaleString(Qt.locale(), "f", 0)
472 onReleased: {
473 formulaPush(text);
474 }
475 }
476
477 KeyboardButton {
478 objectName: "pointButton"
479 id: pointButton
480 x: (calcGridUnit*13)*2
481 y: (calcGridUnit*10)*4
482 text: '.'
483 }
484
485 KeyboardButton {
486 objectName: "sinusButton"
487 id: sinusButton
488 x: (calcGridUnit*13)*4 + calcGridUnit
489 y: (calcGridUnit*10)*4
490 text: "sin"
491 onReleased: {
492 formulaPush('sin(')
493 }
494 }
495
496 KeyboardButton {
497 objectName: "cosinusButton"
498 id: cosinusButton
499 x: (calcGridUnit*13)*5 + calcGridUnit
500 y: (calcGridUnit*10)*4
501 text: "cos"
502 onReleased: {
503 formulaPush('cos(')
504 }
505 }
506
507 KeyboardButton {
508 objectName: "tangensButton"
509 id: tangensButton
510 x: (calcGridUnit*13)*6 + calcGridUnit
511 y: (calcGridUnit*10)*4
512 text: "tan"
513 onReleased: {
514 formulaPush('tan(')
515 }
516 }
517
518 KeyboardButton {
519 objectName: "cotangensButton"
520 id: cotangensButton
521 x: (calcGridUnit*13)*7 + calcGridUnit
522 y: (calcGridUnit*10)*4
523 text: "ctg"
524 onReleased: {
525 formulaPush('atan(')
526 }456 }
527 }457 }
528 }458 }

Subscribers

People subscribed via source and target branches