diff options
author | Topi Reinio <topi.reinio@theqtcompany.com> | 2016-02-23 13:55:59 +0100 |
---|---|---|
committer | Topi Reiniƶ <topi.reinio@theqtcompany.com> | 2016-02-24 11:12:30 +0000 |
commit | 90e9b622f01465666f4ae3f88d1710a36bb2ed1f (patch) | |
tree | 924a7c09b5442a2954de8d6b494341af0db7c8dc /examples/quick/demos/stocqt/content/StockInfo.qml | |
parent | d3f8a608e8e00915df38a2a43496127a93b5bcaf (diff) |
StocQt demo: Bugfixes and improvements
- Update the list of NASDAQ-100 companies
- Add code for handling invalid entries (stock IDs)
- Simplify top-level navigation logic. The app now
opens in list view with no stock pre-selected.
- Fix math for calculating change percentages
Change-Id: I6aaab45f5a391f9636123c0ddca73656fab79916
Task-number: QTBUG-50651
Reviewed-by: Mika Salmela <mika.salmela@theqtcompany.com>
Reviewed-by: Venugopal Shivashankar <venugopal.shivashankar@digia.com>
Diffstat (limited to 'examples/quick/demos/stocqt/content/StockInfo.qml')
-rw-r--r-- | examples/quick/demos/stocqt/content/StockInfo.qml | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/examples/quick/demos/stocqt/content/StockInfo.qml b/examples/quick/demos/stocqt/content/StockInfo.qml index 3c5ee196f2..88f540fa09 100644 --- a/examples/quick/demos/stocqt/content/StockInfo.qml +++ b/examples/quick/demos/stocqt/content/StockInfo.qml @@ -73,7 +73,7 @@ Rectangle { font.family: Settings.fontFamily font.pointSize: 28 font.weight: Font.DemiBold - text: parseFloat(Math.round(root.stock.stockPrice * 100) / 100).toFixed(2); + text: parseFloat(root.stock.stockPrice).toFixed(2); } } @@ -99,7 +99,7 @@ Rectangle { color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930" font.family: Settings.fontFamily font.pointSize: 18 - text: parseFloat(Math.round(root.stock.stockPriceChanged * 100) / 100).toFixed(2); + text: parseFloat(root.stock.stockPriceChanged).toFixed(2); } Text { @@ -110,9 +110,8 @@ Rectangle { font.pointSize: 18 font.weight: Font.DemiBold text: "(" + - Math.abs(Math.round( - root.stock.stockPriceChanged / - (root.stock.stockPrice - root.stock.stockPriceChanged) * 100)) / 100 + + parseFloat(root.stock.stockPriceChanged / + (root.stock.stockPrice - root.stock.stockPriceChanged) * 100.0).toFixed(2) + "%)" } } |