diff options
Diffstat (limited to 'examples/quick/demos/stocqt/content/StockView.qml')
-rw-r--r-- | examples/quick/demos/stocqt/content/StockView.qml | 92 |
1 files changed, 30 insertions, 62 deletions
diff --git a/examples/quick/demos/stocqt/content/StockView.qml b/examples/quick/demos/stocqt/content/StockView.qml index ce55fdf3d3..e503cbea04 100644 --- a/examples/quick/demos/stocqt/content/StockView.qml +++ b/examples/quick/demos/stocqt/content/StockView.qml @@ -39,95 +39,63 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQuick.Window 2.1 Rectangle { id: root width: 320 height: 480 - color: "#423A2F" + color: "transparent" property var stock: null property var stocklist: null - property var settings: null - signal listViewClicked signal settingsClicked function update() { - if (!settings) - return; - chart.endDate = settings.endDate chart.update() } Rectangle { - color: "#272822" + id: mainRect + color: "transparent" anchors.fill: parent - radius: 20 - Image { - source: "images/icon-items.png" + StockInfo { + id: stockInfo anchors.left: parent.left anchors.leftMargin: 10 anchors.top: parent.top - anchors.topMargin: 10 - MouseArea { - anchors.fill: parent - onClicked: listViewClicked() - } - } - Image { - source: "images/icon-settings.png" - anchors.right: parent.right - anchors.rightMargin: 10 - anchors.top: parent.top - anchors.topMargin: 10 - MouseArea { - anchors.fill: parent - onClicked: settingsClicked() - } - } - - Text { - id: desc - anchors.left: parent.left - anchors.leftMargin: 20 - anchors.top: parent.top - anchors.topMargin: 40 - color: "#564c3A" - font.pointSize: 15 - text: root.stock.stockId + " - " + root.stock.stockName + anchors.topMargin: 15 + height: 160 + anchors.right: Screen.primaryOrientation === Qt.PortraitOrientation ? parent.right : chart.left + anchors.rightMargin: 20 + stock: root.stock } - Text { - id: price - anchors.left: parent.left - anchors.leftMargin: 20 - anchors.top: desc.bottom - anchors.topMargin: 5 - color: "#ECC089" - font.pointSize: 30 - text: root.stock.stockPrice + StockChart { + id: chart + anchors.bottom: Screen.primaryOrientation === Qt.PortraitOrientation ? settingsPanel.top : parent.bottom + anchors.bottomMargin: 20 + anchors.top : Screen.primaryOrientation === Qt.PortraitOrientation ? stockInfo.bottom : parent.top + anchors.topMargin: 20 + anchors.right: parent.right + anchors.rightMargin: 20 + width: Screen.primaryOrientation === Qt.PortraitOrientation ? parent.width - 40 : 0.6 * parent.width + stockModel: root.stock + settings: settingsPanel } - Text { - id: priceChange + StockSettingsPanel { + id: settingsPanel anchors.left: parent.left anchors.leftMargin: 20 - anchors.top: price.bottom - anchors.topMargin: 5 - color: root.stock.stockPriceChanged < 0 ? "#A43D3D" : "#679B3A" - font.pointSize: 25 - text: root.stock.stockPriceChanged + " (" + Math.abs(Math.round(root.stock.stockPriceChanged/(root.stock.stockPrice - root.stock.stockPriceChanged) * 100))/100 +"%)" - } - - StockChart { - id: chart + anchors.right: Screen.primaryOrientation === Qt.PortraitOrientation ? parent.right : chart.left + anchors.rightMargin: 20 anchors.bottom: parent.bottom - anchors.top : priceChange.bottom - anchors.topMargin: 30 - width: parent.width - stockModel: root.stock - settings: root.settings + onDrawOpenPriceChanged: root.update() + onDrawClosePriceChanged: root.update(); + onDrawHighPriceChanged: root.update(); + onDrawLowPriceChanged: root.update(); } } } |