aboutsummaryrefslogtreecommitdiffstats
path: root/examples/quick/demos/stocqt/stocqt.qml
diff options
context:
space:
mode:
Diffstat (limited to 'examples/quick/demos/stocqt/stocqt.qml')
-rw-r--r--examples/quick/demos/stocqt/stocqt.qml140
1 files changed, 88 insertions, 52 deletions
diff --git a/examples/quick/demos/stocqt/stocqt.qml b/examples/quick/demos/stocqt/stocqt.qml
index 3e231ab8bf..d4a188d0d2 100644
--- a/examples/quick/demos/stocqt/stocqt.qml
+++ b/examples/quick/demos/stocqt/stocqt.qml
@@ -42,67 +42,103 @@ import QtQuick 2.0
import QtQml.Models 2.1
import "./content"
-ListView {
- id: root
- width: 320
- height: 480
- snapMode: ListView.SnapOneItem
- focus: false
- orientation: ListView.Horizontal
- boundsBehavior: Flickable.StopAtBounds
- currentIndex: 1
+Rectangle {
+ id: mainRect
+ width: 1000
+ height: 700
- Timer {
- id: updateTimer
- interval: 500
- onTriggered: stock.updateStock()
- }
+ property int listViewActive: 0
+
+ Rectangle {
+ id: banner
+ height: 80
+ anchors.top: parent.top
+ width: parent.width
+ color: "#000000"
- StockModel {
- id: stock
- stockId: listView.currentStockId
- stockName: listView.currentStockName
- startDate: settings.startDate
- endDate: settings.endDate
- onStockIdChanged: updateTimer.restart()
- onStartDateChanged: updateTimer.restart()
- onEndDateChanged: updateTimer.restart()
- onDataReady: {
- root.positionViewAtIndex(1, ListView.SnapPosition)
- stockView.update()
+ Image {
+ id: arrow
+ source: "./content/images/icon-left-arrow.png"
+ anchors.left: banner.left
+ anchors.leftMargin: 20
+ anchors.verticalCenter: banner.verticalCenter
+ visible: root.currentIndex == 1 ? true : false
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: listViewActive = 1;
+ }
}
- }
- model: ObjectModel {
- StockListView {
- id: listView
- width: root.width
- height: root.height
+ Item {
+ id: textItem
+ width: stocText.width + qtText.width
+ height: stocText.height + qtText.height
+ anchors.horizontalCenter: banner.horizontalCenter
+ anchors.verticalCenter: banner.verticalCenter
+
+ Text {
+ id: stocText
+ anchors.verticalCenter: textItem.verticalCenter
+ color: "#ffffff"
+ font.family: "Abel"
+ font.pointSize: 40
+ text: "Stoc"
+ }
+ Text {
+ id: qtText
+ anchors.verticalCenter: textItem.verticalCenter
+ anchors.left: stocText.right
+ color: "#5caa15"
+ font.family: "Abel"
+ font.pointSize: 40
+ text: "Qt"
+ }
}
+ }
- StockView {
- id: stockView
- width: root.width
- height: root.height
- stocklist: listView
- settings: settings
- stock: stock
+ ListView {
+ id: root
+ width: parent.width
+ anchors.top: banner.bottom
+ anchors.bottom: parent.bottom
+ snapMode: ListView.SnapOneItem
+ highlightRangeMode: ListView.StrictlyEnforceRange
+ highlightMoveDuration: 250
+ focus: false
+ orientation: ListView.Horizontal
+ boundsBehavior: Flickable.StopAtBounds
+ currentIndex: listViewActive == 0 ? 1 : 0
+ onCurrentIndexChanged: {
+ if (currentIndex == 1)
+ listViewActive = 0;
+ }
- onListViewClicked: root.currentIndex = 0
- onSettingsClicked: root.currentIndex = 2
+ StockModel {
+ id: stock
+ stockId: listView.currentStockId
+ stockName: listView.currentStockName
+ onStockIdChanged: stock.updateStock();
+ onDataReady: {
+ root.positionViewAtIndex(1, ListView.SnapPosition)
+ stockView.update()
+ }
}
- StockSettings {
- id: settings
- width: root.width
- height: root.height
- onDrawHighPriceChanged: stockView.update()
- onDrawLowPriceChanged: stockView.update()
- onDrawOpenPriceChanged: stockView.update()
- onDrawClosePriceChanged: stockView.update()
- onDrawVolumeChanged: stockView.update()
- onDrawKLineChanged: stockView.update()
- onChartTypeChanged: stockView.update()
+ model: ObjectModel {
+ StockListView {
+ id: listView
+ width: root.width
+ height: root.height
+ }
+
+ StockView {
+ id: stockView
+ width: root.width
+ height: root.height
+ stocklist: listView
+ stock: stock
+ }
}
}
}