diff options
Diffstat (limited to 'examples/quick/demos/stocqt/stocqt.qml')
-rw-r--r-- | examples/quick/demos/stocqt/stocqt.qml | 115 |
1 files changed, 38 insertions, 77 deletions
diff --git a/examples/quick/demos/stocqt/stocqt.qml b/examples/quick/demos/stocqt/stocqt.qml index 6b1da1713a..a13e63fd50 100644 --- a/examples/quick/demos/stocqt/stocqt.qml +++ b/examples/quick/demos/stocqt/stocqt.qml @@ -40,6 +40,7 @@ import QtQuick 2.0 import QtQml.Models 2.1 +import QtQuick.Layouts 1.1 import "./content" Rectangle { @@ -49,90 +50,50 @@ Rectangle { property alias currentIndex: root.currentIndex - Rectangle { - id: banner - height: 80 - anchors.top: parent.top - width: parent.width - color: "#000000" + ColumnLayout { + anchors.fill: parent - 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: root.currentIndex = 0; - } - } - - 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" - } + Banner { + id: banner + Layout.fillWidth: true } - } - 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 + ListView { + id: root + Layout.fillHeight: true + Layout.fillWidth: true + snapMode: ListView.SnapOneItem + highlightRangeMode: ListView.StrictlyEnforceRange + highlightMoveDuration: 250 + focus: false + orientation: ListView.Horizontal + boundsBehavior: Flickable.StopAtBounds - StockModel { - id: stock - stockId: listView.currentStockId - stockName: listView.currentStockName - onStockIdChanged: stock.updateStock(); - onDataReady: { - root.currentIndex = 1 - stockView.update() + StockModel { + id: stock + stockId: listView.currentStockId + stockName: listView.currentStockName + onStockIdChanged: stock.updateStock(); + onDataReady: { + root.currentIndex = 1 + stockView.update() + } } - } - model: ObjectModel { - StockListView { - id: listView - width: root.width - height: root.height - } + model: ObjectModel { + StockListView { + id: listView + width: root.width + height: root.height + } - StockView { - id: stockView - width: root.width - height: root.height - stocklist: listView - stock: stock + StockView { + id: stockView + width: root.width + height: root.height + stocklist: listView + stock: stock + } } } } |