summaryrefslogtreecommitdiff
path: root/examples/quick
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick')
-rw-r--r--examples/quick/canvas/squircle/squircle.qml4
-rw-r--r--examples/quick/demos/stocqt/content/StockInfo.qml126
-rw-r--r--examples/quick/demos/stocqt/content/StockListView.qml4
3 files changed, 67 insertions, 67 deletions
diff --git a/examples/quick/canvas/squircle/squircle.qml b/examples/quick/canvas/squircle/squircle.qml
index 7c62ef5d0..04c9df42d 100644
--- a/examples/quick/canvas/squircle/squircle.qml
+++ b/examples/quick/canvas/squircle/squircle.qml
@@ -90,9 +90,9 @@ Item {
onFillChanged: requestPaint();
onStrokeChanged: requestPaint();
- onPaint: squcirle();
+ onPaint: squircle();
- function squcirle() {
+ function squircle() {
var ctx = canvas.getContext("2d");
var N = canvas.nSize;
var R = canvas.radius;
diff --git a/examples/quick/demos/stocqt/content/StockInfo.qml b/examples/quick/demos/stocqt/content/StockInfo.qml
index 337cc79f7..50f6b9107 100644
--- a/examples/quick/demos/stocqt/content/StockInfo.qml
+++ b/examples/quick/demos/stocqt/content/StockInfo.qml
@@ -48,72 +48,72 @@ Rectangle {
property var stock: null
- Text {
- id: stockIdText
- anchors.left: parent.left
- anchors.leftMargin: 5
- anchors.top: parent.top
- anchors.topMargin: 15
- color: "#000000"
- font.family: "Open Sans"
- font.pointSize: 38
- font.weight: Font.DemiBold
- text: root.stock.stockId
- }
+ Column {
+ id: stockColumn
+ anchors.fill: parent
+ spacing: 4
- Text {
- id: stockNameText
- anchors.left: parent.left
- anchors.leftMargin: 5
- anchors.bottom: priceChangePercentage.bottom
- anchors.right: priceChangePercentage.left
- anchors.rightMargin: 15
- color: "#000000"
- font.family: "Open Sans"
- font.pointSize: 16
- elide: Text.ElideRight
- text: root.stock.stockName
- }
+ Flow {
+ anchors { left: parent.left; right: parent.right }
+ spacing: 12
- Text {
- id: price
- anchors.right: parent.right
- anchors.rightMargin: 5
- anchors.top: parent.top
- anchors.topMargin: 15
- horizontalAlignment: Text.AlignRight
- color: "#000000"
- font.family: "Open Sans"
- font.pointSize: 30
- font.weight: Font.DemiBold
- text: root.stock.stockPrice
- }
+ Text {
+ id: stockIdText
+ color: "#000000"
+ font.family: "Open Sans"
+ font.pointSize: 28
+ font.weight: Font.DemiBold
+ text: root.stock.stockId
+ }
- Text {
- id: priceChange
- anchors.right: parent.right
- anchors.rightMargin: 20
- anchors.top: price.bottom
- anchors.topMargin: 5
- horizontalAlignment: Text.AlignRight
- color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930"
- font.family: "Open Sans"
- font.pointSize: 20
- font.weight: Font.Bold
- text: root.stock.stockPriceChanged
- }
+ Text {
+ id: price
+ color: "#6d6d6d"
+ font.family: "Open Sans"
+ font.pointSize: 28
+ font.weight: Font.DemiBold
+ text: parseFloat(Math.round(root.stock.stockPrice * 100) / 100).toFixed(2);
+ }
+ }
+
+ Text {
+ id: stockNameText
+ color: "#0c0c0c"
+ font.family: "Open Sans"
+ font.pointSize: 16
+ width: stockColumn.width
+ elide: Text.ElideRight
+ maximumLineCount: 3
+ wrapMode: Text.WordWrap
+ text: root.stock.stockName
+ }
+
+ Flow {
+ anchors { left: parent.left; right: parent.right }
+ spacing: 12
+
+ Text {
+ id: priceChange
+ horizontalAlignment: Text.AlignRight
+ color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930"
+ font.family: "Open Sans"
+ font.pointSize: 18
+ text: parseFloat(Math.round(root.stock.stockPriceChanged * 100) / 100).toFixed(2);
+ }
- Text {
- id: priceChangePercentage
- anchors.right: parent.right
- anchors.rightMargin: 20
- anchors.top: priceChange.bottom
- anchors.topMargin: 5
- horizontalAlignment: Text.AlignRight
- color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930"
- font.family: "Open Sans"
- font.pointSize: 18
- font.weight: Font.Bold
- text: Math.abs(Math.round(root.stock.stockPriceChanged/(root.stock.stockPrice - root.stock.stockPriceChanged) * 100))/100 +"%"
+ Text {
+ id: priceChangePercentage
+ horizontalAlignment: Text.AlignRight
+ color: root.stock.stockPriceChanged < 0 ? "#d40000" : "#328930"
+ font.family: "Open Sans"
+ font.pointSize: 18
+ font.weight: Font.DemiBold
+ text: "(" +
+ Math.abs(Math.round(
+ root.stock.stockPriceChanged /
+ (root.stock.stockPrice - root.stock.stockPriceChanged) * 100)) / 100 +
+ "%)"
+ }
+ }
}
}
diff --git a/examples/quick/demos/stocqt/content/StockListView.qml b/examples/quick/demos/stocqt/content/StockListView.qml
index 53e345db5..470531a21 100644
--- a/examples/quick/demos/stocqt/content/StockListView.qml
+++ b/examples/quick/demos/stocqt/content/StockListView.qml
@@ -96,9 +96,9 @@ Rectangle {
var records = xhr.responseText.split('\n');
if (records.length > 0) {
var r = records[1].split(',');
- model.setProperty(index, "value", r[4]);
-
var today = parseFloat(r[4]);
+ model.setProperty(index, "value", today.toFixed(2));
+
r = records[2].split(',');
var yesterday = parseFloat(r[4]);
var change = today - yesterday;