From dbdb8960ebc3e2fe7a91185c521d53c688411930 Mon Sep 17 00:00:00 2001 From: Mitch Curtis Date: Fri, 6 Nov 2015 12:50:31 +0100 Subject: Improve testbench - Rearrange items. - Replace more usages of Rectangle with Frame. - Add SpinBox. - Add indeterminate ProgressBar. Change-Id: I38f15fdfbbf35c8d2c87e629e4e0ccaa4ae0b5fd Reviewed-by: J-P Nurmi --- tests/manual/testbench/main.qml | 578 ++++++++++++++++++++-------------------- 1 file changed, 295 insertions(+), 283 deletions(-) (limited to 'tests') diff --git a/tests/manual/testbench/main.qml b/tests/manual/testbench/main.qml index 75c901f1..711c6e08 100644 --- a/tests/manual/testbench/main.qml +++ b/tests/manual/testbench/main.qml @@ -48,7 +48,7 @@ import Qt.labs.controls 1.0 ApplicationWindow { id: window visible: true - width: 700 + width: 750 height: 1000 Theme.backgroundColor: themeSwitch.checked ? "#444" : "#fff" @@ -60,361 +60,373 @@ ApplicationWindow { // Material.theme: themeSwitch.checked ? Material.Dark : Material.Light // Universal.theme: themeSwitch.checked ? Universal.Dark : Universal.Light - property int margins: 30 - property int spacing: 10 - - Switch { - id: themeSwitch - text: "Light/Dark" - anchors.right: parent.right - } - - Flow { - id: flow - anchors.fill: parent - anchors.margins: 30 - spacing: 30 - - RowLayout { - BusyIndicator { - } - BusyIndicator { - enabled: false - } - } + property int controlSpacing: 10 + header: ToolBar { RowLayout { - spacing: window.spacing + anchors.fill: parent - Button { + ToolButton { text: "Normal" } - Button { + ToolButton { text: "Pressed" pressed: true } - Button { + ToolButton { text: "Disabled" enabled: false } - } - - RowLayout { - Frame { - Label { - text: "Normal\nLabel" - horizontalAlignment: Text.AlignHCenter - } + Item { + Layout.fillWidth: true } - Frame { - enabled: false - - Label { - text: "Disabled\nLabel" - horizontalAlignment: Text.AlignHCenter - } + Switch { + id: themeSwitch + text: "Light/Dark" + layoutDirection: Qt.RightToLeft } } + } - RowLayout { - CheckBox { - text: "Normal" - } - CheckBox { - text: "Pressed" - pressed: true - } - CheckBox { - text: "Checked" - checked: true - } - CheckBox { - text: "Checked + Pressed" - checked: true - pressed: true - } - CheckBox { - text: "Disabled" - enabled: false - } - } + Flickable { + anchors.fill: parent + flickableDirection: Flickable.VerticalFlick - RowLayout { - Dial { - } - Dial { - enabled: false - } - } + Flow { + id: flow + anchors.fill: parent + anchors.margins: 30 + spacing: 30 - RowLayout { - GroupBox { - title: "Normal" + RowLayout { + spacing: window.controlSpacing - Item { - implicitWidth: 100 - implicitHeight: 100 + Button { + text: "Normal" + } + Button { + text: "Pressed" + pressed: true + } + Button { + text: "Disabled" + enabled: false } } - GroupBox { - enabled: false - title: "Disabled" - Item { - implicitWidth: 100 - implicitHeight: 100 + RowLayout { + TabBar { + TabButton { + text: "Normal" + } + TabButton { + text: "Pressed" + pressed: true + } + TabButton { + text: "Disabled" + enabled: false + } } } - } - RowLayout { - PageIndicator { - count: 5 - } - PageIndicator { - count: 5 - enabled: false + RowLayout { + CheckBox { + text: "Normal" + } + CheckBox { + text: "Pressed" + pressed: true + } + CheckBox { + text: "Checked" + checked: true + } + CheckBox { + text: "Checked + Pressed" + checked: true + pressed: true + } + CheckBox { + text: "Disabled" + enabled: false + } } - } - RowLayout { - ProgressBar { - value: 0.5 - } - ProgressBar { - value: 0.5 - enabled: false + RowLayout { + RadioButton { + text: "Normal" + } + RadioButton { + text: "Pressed" + pressed: true + } + RadioButton { + text: "Checked" + checked: true + } + RadioButton { + text: "Checked + Pressed" + checked: true + pressed: true + } + RadioButton { + text: "Disabled" + enabled: false + } } - } - RowLayout { - RadioButton { - text: "Normal" - } - RadioButton { - text: "Pressed" - pressed: true - } - RadioButton { - text: "Checked" - checked: true - } - RadioButton { - text: "Checked + Pressed" - checked: true - pressed: true - } - RadioButton { - text: "Disabled" - enabled: false + RowLayout { + Switch { + text: "Normal" + } + Switch { + text: "Pressed" + pressed: true + } + Switch { + text: "Checked" + checked: true + } + Switch { + text: "Checked + Pressed" + checked: true + pressed: true + } + Switch { + text: "Disabled" + enabled: false + } } - } - RowLayout { - Frame { - Layout.preferredWidth: 100 - Layout.preferredHeight: 100 - - ScrollBar { - size: 0.3 - position: 0.2 - active: true - orientation: Qt.Vertical - height: parent.height - anchors.right: parent.right + RowLayout { + ProgressBar { + value: 0.5 + } + ProgressBar { + value: 0.5 + indeterminate: true + } + ProgressBar { + value: 0.5 + enabled: false } } - Frame { - Layout.preferredWidth: 100 - Layout.preferredHeight: 100 - - ScrollBar { - size: 0.3 - position: 0.2 - active: true - orientation: Qt.Vertical - height: parent.height - anchors.right: parent.right + RowLayout { + Slider { + value: 0.5 + } + Slider { + value: 0.5 pressed: true } + Slider { + value: 0.5 + enabled: false + } } - Frame { - Layout.preferredWidth: 100 - Layout.preferredHeight: 100 - - ScrollBar { - size: 0.3 - position: 0.2 - active: true - orientation: Qt.Vertical - height: parent.height - anchors.right: parent.right + RowLayout { + RangeSlider { + first.value: 0.25 + second.value: 0.75 + } + RangeSlider { + first.value: 0.25 + first.pressed: true + second.value: 0.75 + } + RangeSlider { + first.value: 0.25 + second.value: 0.75 enabled: false } } - } - RowLayout { - Rectangle { - width: 100 - height: 100 - color: "transparent" - border.color: "#cccccc" - - ScrollIndicator { - size: 0.3 - position: 0.2 - active: true - orientation: Qt.Vertical - height: parent.height - anchors.right: parent.right + RowLayout { + TextArea { + text: "Normal" + } + TextArea { + text: "Disabled" + enabled: false } } - Rectangle { - width: 100 - height: 100 - color: "transparent" - border.color: "#cccccc" - - ScrollIndicator { - size: 0.3 - position: 0.2 - active: true - orientation: Qt.Vertical - height: parent.height - anchors.right: parent.right + RowLayout { + TextField { + text: "Normal" + } + TextField { + text: "Disabled" enabled: false } } - } - RowLayout { - Slider { - value: 0.5 - } - Slider { - value: 0.5 - pressed: true - } - Slider { - value: 0.5 - enabled: false + RowLayout { + SpinBox { + } + SpinBox { + up.pressed: true + } + SpinBox { + enabled: false + } } - } - RowLayout { - RangeSlider { - first.value: 0.25 - second.value: 0.75 - } - RangeSlider { - first.value: 0.25 - first.pressed: true - second.value: 0.75 - } - RangeSlider { - first.value: 0.25 - second.value: 0.75 - enabled: false - } - } + RowLayout { + GroupBox { + title: "Normal" - RowLayout { - Switch { - text: "Normal" - } - Switch { - text: "Pressed" - pressed: true - } - Switch { - text: "Checked" - checked: true - } - Switch { - text: "Checked + Pressed" - checked: true - pressed: true - } - Switch { - text: "Disabled" - enabled: false - } - } + Item { + implicitWidth: 100 + implicitHeight: 100 - RowLayout { - TabBar { - TabButton { - text: "Normal" - } - TabButton { - text: "Pressed" - pressed: true + BusyIndicator { + anchors.centerIn: parent + } + } } - TabButton { - text: "Disabled" + GroupBox { enabled: false + title: "Disabled" + + Item { + implicitWidth: 100 + implicitHeight: 100 + + BusyIndicator { + anchors.centerIn: parent + } + } } } - } - RowLayout { - TextArea { - text: "Normal" - } - TextArea { - text: "Disabled" - enabled: false + RowLayout { + Frame { + Tumbler { + model: 5 + implicitWidth: 100 + implicitHeight: 100 + } + } + Frame { + Tumbler { + model: 5 + implicitWidth: 100 + implicitHeight: 100 + enabled: false + } + } } - } - RowLayout { - TextField { - text: "Normal" - } - TextField { - text: "Disabled" - enabled: false - } - } + RowLayout { + Frame { + Layout.preferredWidth: 100 + Layout.preferredHeight: 100 - RowLayout { - ToolBar { - Row { - ToolButton { - text: "Normal!" + ScrollBar { + size: 0.3 + position: 0.2 + active: true + orientation: Qt.Vertical + height: parent.height + anchors.right: parent.right } - ToolButton { - text: "Pressed!" + } + + Frame { + Layout.preferredWidth: 100 + Layout.preferredHeight: 100 + + ScrollBar { + size: 0.3 + position: 0.2 + active: true + orientation: Qt.Vertical + height: parent.height + anchors.right: parent.right pressed: true } - ToolButton { - text: "Disabled!" + } + + Frame { + Layout.preferredWidth: 100 + Layout.preferredHeight: 100 + + ScrollBar { + size: 0.3 + position: 0.2 + active: true + orientation: Qt.Vertical + height: parent.height + anchors.right: parent.right enabled: false } } } - } - RowLayout { - Frame { - Tumbler { - model: 5 - implicitWidth: 100 - implicitHeight: 100 + RowLayout { + Frame { + Layout.preferredWidth: 100 + Layout.preferredHeight: 100 + + ScrollIndicator { + size: 0.3 + position: 0.2 + active: true + orientation: Qt.Vertical + height: parent.height + anchors.right: parent.right + } + } + + Frame { + Layout.preferredWidth: 100 + Layout.preferredHeight: 100 + + ScrollIndicator { + size: 0.3 + position: 0.2 + active: true + orientation: Qt.Vertical + height: parent.height + anchors.right: parent.right + enabled: false + } } } - Frame { - Tumbler { - model: 5 - implicitWidth: 100 - implicitHeight: 100 + + PageIndicator { + count: 5 + enabled: false + } + + RowLayout { + Dial { + } + Dial { enabled: false } } + + RowLayout { + Frame { + Label { + text: "Normal\nLabel" + horizontalAlignment: Text.AlignHCenter + } + } + Frame { + enabled: false + + Label { + text: "Disabled\nLabel" + horizontalAlignment: Text.AlignHCenter + } + } + } } } } -- cgit v1.2.3