From 8dca45fa2ad0f260143282ee01d52e72f8f88a68 Mon Sep 17 00:00:00 2001 From: Yann Bodson Date: Thu, 15 Apr 2010 19:03:12 +1000 Subject: Small calculator fix. --- demos/declarative/calculator/Core/calculator.js | 2 +- demos/declarative/calculator/calculator.qml | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/demos/declarative/calculator/Core/calculator.js b/demos/declarative/calculator/Core/calculator.js index 2b19de8..51b3dd3 100644 --- a/demos/declarative/calculator/Core/calculator.js +++ b/demos/declarative/calculator/Core/calculator.js @@ -54,7 +54,7 @@ function doOperation(op) { if (op == "1/x") { display.text = (1 / display.text.valueOf()).toString() - } else if (op == "^2") { + } else if (op == "x^2") { display.text = (display.text.valueOf() * display.text.valueOf()).toString() } else if (op == "Abs") { display.text = (Math.abs(display.text.valueOf())).toString() diff --git a/demos/declarative/calculator/calculator.qml b/demos/declarative/calculator/calculator.qml index fc2b95a..286a4d1 100644 --- a/demos/declarative/calculator/calculator.qml +++ b/demos/declarative/calculator/calculator.qml @@ -36,28 +36,28 @@ Rectangle { id: column; spacing: 6 property real h: ((box.height - 72) / 6) - ((spacing * (6 - 1)) / 6) + property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4) Row { spacing: 6 - property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4) Button { id: rotateButton - width: parent.w; height: column.h; color: 'purple'; operation: rotateLeft + width: column.w; height: column.h; color: 'purple'; operation: rotateLeft } - Button { width: parent.w; height: column.h; color: 'purple'; operation: leftArrow } - Button { width: parent.w; height: column.h; color: 'purple'; operation: "C" } - Button { width: parent.w; height: column.h; color: 'purple'; operation: "AC" } + Button { width: column.w; height: column.h; color: 'purple'; operation: leftArrow } + Button { width: column.w; height: column.h; color: 'purple'; operation: "C" } + Button { width: column.w; height: column.h; color: 'purple'; operation: "AC" } } Row { spacing: 6 property real w: (box.width / 4) - ((spacing * (4 - 1)) / 4) - Button { width: parent.w; height: column.h; color: 'green'; operation: "mc" } - Button { width: parent.w; height: column.h; color: 'green'; operation: "m+" } - Button { width: parent.w; height: column.h; color: 'green'; operation: "m-" } - Button { width: parent.w; height: column.h; color: 'green'; operation: "mr" } + Button { width: column.w; height: column.h; color: 'green'; operation: "mc" } + Button { width: column.w; height: column.h; color: 'green'; operation: "m+" } + Button { width: column.w; height: column.h; color: 'green'; operation: "m-" } + Button { width: column.w; height: column.h; color: 'green'; operation: "mr" } } Grid { -- cgit v0.12