summaryrefslogtreecommitdiffstats
path: root/examples/demos/stocqt/content/StockView.qml
blob: 736230011c56b59bc72ea3aa850808f9222efb01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
// Copyright (C) 2017 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause

import QtQuick
import QtQuick.Window
import QtQuick.Layouts

Rectangle {
    id: root
    width: 320
    height: 480
    color: "transparent"

    property var stock: null
    property var stocklist: null
    signal settingsClicked

    function update() {
        chart.update()
    }

    Rectangle {
        id: mainRect
        color: "transparent"
        anchors.fill: parent

        GridLayout {
            anchors.fill: parent
            rows: 2
            columns: Screen.primaryOrientation === Qt.PortraitOrientation ? 1 : 2

            StockInfo {
                id: stockInfo
                Layout.alignment: Qt.AlignTop
                Layout.preferredWidth: 400
                Layout.preferredHeight: 160
                stock: root.stock
            }

            StockChart {
                id: chart
                Layout.alignment: Qt.AlignRight
                Layout.margins: 5
                Layout.fillWidth: true
                Layout.fillHeight: true
                Layout.rowSpan: 2
                stockModel: root.stock
                settings: settingsPanel
            }
            StockSettingsPanel {
                id: settingsPanel
                Layout.alignment: Qt.AlignBottom
                Layout.fillHeight: true
                Layout.preferredWidth: 400
                Layout.bottomMargin: 5
                onDrawOpenPriceChanged: root.update()
                onDrawClosePriceChanged: root.update();
                onDrawHighPriceChanged: root.update();
                onDrawLowPriceChanged: root.update();
            }
        }
    }
}