diff options
author | Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> | 2016-11-18 17:35:29 +0100 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2016-11-30 14:28:25 +0000 |
commit | 63c34dc6c1c6f24f8e83f295adc70fdcc392f8c5 (patch) | |
tree | 8081b7de90b5f2deab0fe74af7991229070dbc6c /examples/quick/demos/stocqt/content/StockSettingsPanel.qml | |
parent | 005857c492ff2a907987e5aed4c61163a6f3fc44 (diff) |
StocQt example: Use QtQuick.Layouts instead of anchors
- Move the StockListView delegate and the top banner to
separate files.
- Use QtQuick.Layouts in place of anchors for most parts,
improving code readability and app scalability.
Change-Id: Ie8f13ef261bb343f15e9484bd15f8b94101daeb5
Reviewed-by: Topi Reiniƶ <topi.reinio@qt.io>
Diffstat (limited to 'examples/quick/demos/stocqt/content/StockSettingsPanel.qml')
-rw-r--r-- | examples/quick/demos/stocqt/content/StockSettingsPanel.qml | 204 |
1 files changed, 89 insertions, 115 deletions
diff --git a/examples/quick/demos/stocqt/content/StockSettingsPanel.qml b/examples/quick/demos/stocqt/content/StockSettingsPanel.qml index 0c34e453de..1ac1035789 100644 --- a/examples/quick/demos/stocqt/content/StockSettingsPanel.qml +++ b/examples/quick/demos/stocqt/content/StockSettingsPanel.qml @@ -39,12 +39,11 @@ ****************************************************************************/ import QtQuick 2.0 +import QtQuick.Layouts 1.1 import "." Rectangle { id: root - width: 440 - height: 160 color: "transparent" property bool drawOpenPrice: openButton.buttonEnabled @@ -58,118 +57,93 @@ Rectangle { property string lowColor: "#f30000" property string volumeColor: "#14aaff" - Text { - id: openText - anchors.left: root.left - anchors.top: root.top - color: "#000000" - font.family: Settings.fontFamily - font.pointSize: 19 - text: "Open" - } - - Text { - id: closeText - anchors.left: root.left - anchors.top: openText.bottom - anchors.topMargin: 10 - color: "#000000" - font.family: Settings.fontFamily - font.pointSize: 19 - text: "Close" - } - - Text { - id: highText - anchors.left: root.left - anchors.top: closeText.bottom - anchors.topMargin: 10 - color: "#000000" - font.family: Settings.fontFamily - font.pointSize: 19 - text: "High" - } - - Text { - id: lowText - anchors.left: root.left - anchors.top: highText.bottom - anchors.topMargin: 10 - color: "#000000" - font.family: Settings.fontFamily - font.pointSize: 19 - text: "Low" - } - - Rectangle { - height: 4 - anchors.left: root.left - anchors.leftMargin: 114 - anchors.right: openButton.left - anchors.rightMargin: 65 - anchors.verticalCenter: openText.verticalCenter - color: openColor - } - - Rectangle { - height: 4 - anchors.left: root.left - anchors.leftMargin: 114 - anchors.right: closeButton.left - anchors.rightMargin: 65 - anchors.verticalCenter: closeText.verticalCenter - color: closeColor - } - - Rectangle { - height: 4 - anchors.left: root.left - anchors.leftMargin: 114 - anchors.right: highButton.left - anchors.rightMargin: 65 - anchors.verticalCenter: highText.verticalCenter - color: highColor - } - - Rectangle { - height: 4 - anchors.left: root.left - anchors.leftMargin: 114 - anchors.right: lowButton.left - anchors.rightMargin: 65 - anchors.verticalCenter: lowText.verticalCenter - color: lowColor - } - - CheckBox { - id: openButton - buttonEnabled: false - anchors.verticalCenter: openText.verticalCenter - anchors.right: root.right - anchors.rightMargin: 40 - } - - CheckBox { - id: closeButton - buttonEnabled: false - anchors.verticalCenter: closeText.verticalCenter - anchors.right: root.right - anchors.rightMargin: 40 - } - - CheckBox { - id: highButton - buttonEnabled: true - anchors.verticalCenter: highText.verticalCenter - anchors.right: root.right - anchors.rightMargin: 40 - } - - CheckBox { - id: lowButton - buttonEnabled: true - anchors.verticalCenter: lowText.verticalCenter - anchors.right: root.right - anchors.rightMargin: 40 + GridLayout { + id: settingsGrid + rows: 5 + columns: 3 + rowSpacing: 4 + anchors.fill: parent + + Item { + Layout.fillHeight: true + Layout.columnSpan: 3 + } + + Text { + id: openText + color: "#000000" + font.family: Settings.fontFamily + font.pointSize: 19 + text: "Open" + Layout.leftMargin: 10 + } + Rectangle { + Layout.preferredHeight: 4 + Layout.preferredWidth: 114 + color: openColor + } + CheckBox { + id: openButton + buttonEnabled: false + Layout.rightMargin: 10 + } + + Text { + id: closeText + Layout.leftMargin: 10 + color: "#000000" + font.family: Settings.fontFamily + font.pointSize: 19 + text: "Close" + } + Rectangle { + Layout.preferredHeight: 4 + Layout.preferredWidth: 114 + color: closeColor + } + CheckBox { + id: closeButton + buttonEnabled: false + Layout.rightMargin: 10 + } + + Text { + id: highText + Layout.leftMargin: 10 + color: "#000000" + font.family: Settings.fontFamily + font.pointSize: 19 + text: "High" + } + Rectangle { + Layout.preferredHeight: 4 + Layout.preferredWidth: 114 + color: highColor + } + CheckBox { + id: highButton + buttonEnabled: true + Layout.rightMargin: 10 + } + + Text { + id: lowText + Layout.leftMargin: 10 + color: "#000000" + font.family: Settings.fontFamily + font.pointSize: 19 + text: "Low" + } + Rectangle { + Layout.preferredHeight: 4 + Layout.preferredWidth: 114 + color: lowColor + } + + CheckBox { + id: lowButton + buttonEnabled: true + Layout.rightMargin: 10 + } } } |