From f83d12e0c27ad76d98d66a663140a09698b11d37 Mon Sep 17 00:00:00 2001 From: Topi Reinio Date: Wed, 24 Sep 2014 14:37:46 +0200 Subject: Update the Calqltr demo visuals and engine logic MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add logic for displaying the calculation result in the best available precision, determined by the display width - Display 'ERROR' when the result cannot be displayed - Animate the number pad button colors to react to presses and visually disable them when pressing the button has no effect - Fix issues in calculator.js logic - Update documentation accordingly Task-number: QTBUG-41253 Change-Id: Ibed7b8218ea4cd074b8f9b90d9bb4e3ea6b25ba2 Reviewed-by: Johanna Äijälä Reviewed-by: Leena Miettinen Reviewed-by: Venugopal Shivashankar --- examples/quick/demos/calqlatr/calqlatr.qml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'examples/quick/demos/calqlatr/calqlatr.qml') diff --git a/examples/quick/demos/calqlatr/calqlatr.qml b/examples/quick/demos/calqlatr/calqlatr.qml index 02c5b13399..8bda2c521e 100644 --- a/examples/quick/demos/calqlatr/calqlatr.qml +++ b/examples/quick/demos/calqlatr/calqlatr.qml @@ -53,13 +53,22 @@ Rectangle { onWidthChanged: controller.reload() onHeightChanged: controller.reload() - function operatorPressed(operator) { CalcEngine.operatorPressed(operator) } - function digitPressed(digit) { CalcEngine.digitPressed(digit) } + function operatorPressed(operator) { + CalcEngine.operatorPressed(operator) + numPad.buttonPressed() + } + function digitPressed(digit) { + CalcEngine.digitPressed(digit) + numPad.buttonPressed() + } + function isButtonDisabled(op) { + return CalcEngine.disabled(op) + } Item { id: pad width: 180 - NumberPad { y: 10; anchors.horizontalCenter: parent.horizontalCenter } + NumberPad { id: numPad; y: 10; anchors.horizontalCenter: parent.horizontalCenter } } AnimationController { -- cgit v1.2.3