Update testbench

Move some things around. Also, begin to set all themes in
main.qml. There will be at least two unused themes instantiated,
but it doesn't matter, as it's just a manual test.

Change-Id: Icd8b24d3db3068e05b35de5ce55b4d418a530e5e
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
This commit is contained in:
Mitch Curtis 2015-10-30 16:07:48 +01:00 committed by J-P Nurmi
parent 20d00976a0
commit 72f3a5a095
7 changed files with 370 additions and 402 deletions

View File

@ -1,367 +0,0 @@
import QtQuick 2.6
import QtQuick.Layouts 1.2
import Qt.labs.controls 1.0
Rectangle {
id: root
property alias themeSwitch: themeSwitch
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
}
}
RowLayout {
spacing: root.spacing
Button {
text: "Normal"
}
Button {
text: "Pressed"
pressed: true
}
Button {
text: "Disabled"
enabled: false
}
}
RowLayout {
Frame {
Label {
text: "Normal\nLabel"
horizontalAlignment: Text.AlignHCenter
}
}
Frame {
enabled: false
Label {
text: "Disabled\nLabel"
horizontalAlignment: Text.AlignHCenter
}
}
}
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 {
Dial {
}
Dial {
enabled: false
}
}
RowLayout {
GroupBox {
title: "Normal"
Item {
implicitWidth: 100
implicitHeight: 100
}
}
GroupBox {
enabled: false
title: "Disabled"
Item {
implicitWidth: 100
implicitHeight: 100
}
}
}
RowLayout {
PageIndicator {
count: 5
}
PageIndicator {
count: 5
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 {
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
}
}
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
}
}
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 {
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
}
}
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
enabled: false
}
}
}
RowLayout {
Slider {
value: 0.5
}
Slider {
value: 0.5
pressed: true
}
Slider {
value: 0.5
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 {
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 {
TabBar {
TabButton {
text: "Normal"
}
TabButton {
text: "Pressed"
pressed: true
}
TabButton {
text: "Disabled"
enabled: false
}
}
}
RowLayout {
TextArea {
text: "Normal"
}
TextArea {
text: "Disabled"
enabled: false
}
}
RowLayout {
TextField {
text: "Normal"
}
TextField {
text: "Disabled"
enabled: false
}
}
RowLayout {
ToolBar {
Row {
ToolButton {
text: "Normal!"
}
ToolButton {
text: "Pressed!"
pressed: true
}
ToolButton {
text: "Disabled!"
enabled: false
}
}
}
}
RowLayout {
Frame {
Tumbler {
model: 5
implicitWidth: 100
implicitHeight: 100
}
}
Frame {
Tumbler {
model: 5
implicitWidth: 100
implicitHeight: 100
enabled: false
}
}
}
}
}

View File

@ -45,6 +45,10 @@ int main(int argc, char *argv[])
{
QGuiApplication app(argc, argv);
// These must be set before running.
// TODO: move style selection into app UI and use settings to save choices.
// qsetenv("QT_FILE_SELECTORS", "material");
// qsetenv("QT_LABS_CONTROLS_STYLE", "material");
QQmlApplicationEngine engine;
engine.load(QUrl(QStringLiteral("qrc:/main.qml")));

View File

@ -42,6 +42,8 @@ import QtQuick 2.3
import QtQuick.Window 2.2
import QtQuick.Layouts 1.0
import Qt.labs.controls 1.0
//import Qt.labs.controls.material 1.0
//import Qt.labs.controls.universal 1.0
ApplicationWindow {
id: window
@ -49,9 +51,371 @@ ApplicationWindow {
width: 700
height: 1000
Loader {
Theme.backgroundColor: themeSwitch.checked ? "#444" : "#fff"
Theme.frameColor: themeSwitch.checked ? "#666" : "#ccc"
Theme.textColor: themeSwitch.checked ? "#eee" : "#111"
Theme.pressColor: themeSwitch.checked ? "#33ffffff" : "#33333333"
Theme.baseColor: themeSwitch.checked ? "#444" : "#eee"
// 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
source: "qrc:/styles/Style.qml"
anchors.margins: 30
spacing: 30
RowLayout {
BusyIndicator {
}
BusyIndicator {
enabled: false
}
}
RowLayout {
spacing: window.spacing
Button {
text: "Normal"
}
Button {
text: "Pressed"
pressed: true
}
Button {
text: "Disabled"
enabled: false
}
}
RowLayout {
Frame {
Label {
text: "Normal\nLabel"
horizontalAlignment: Text.AlignHCenter
}
}
Frame {
enabled: false
Label {
text: "Disabled\nLabel"
horizontalAlignment: Text.AlignHCenter
}
}
}
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 {
Dial {
}
Dial {
enabled: false
}
}
RowLayout {
GroupBox {
title: "Normal"
Item {
implicitWidth: 100
implicitHeight: 100
}
}
GroupBox {
enabled: false
title: "Disabled"
Item {
implicitWidth: 100
implicitHeight: 100
}
}
}
RowLayout {
PageIndicator {
count: 5
}
PageIndicator {
count: 5
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 {
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
}
}
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
}
}
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 {
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
}
}
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
enabled: false
}
}
}
RowLayout {
Slider {
value: 0.5
}
Slider {
value: 0.5
pressed: true
}
Slider {
value: 0.5
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 {
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 {
TabBar {
TabButton {
text: "Normal"
}
TabButton {
text: "Pressed"
pressed: true
}
TabButton {
text: "Disabled"
enabled: false
}
}
}
RowLayout {
TextArea {
text: "Normal"
}
TextArea {
text: "Disabled"
enabled: false
}
}
RowLayout {
TextField {
text: "Normal"
}
TextField {
text: "Disabled"
enabled: false
}
}
RowLayout {
ToolBar {
Row {
ToolButton {
text: "Normal!"
}
ToolButton {
text: "Pressed!"
pressed: true
}
ToolButton {
text: "Disabled!"
enabled: false
}
}
}
}
RowLayout {
Frame {
Tumbler {
model: 5
implicitWidth: 100
implicitHeight: 100
}
}
Frame {
Tumbler {
model: 5
implicitWidth: 100
implicitHeight: 100
enabled: false
}
}
}
}
}

View File

@ -1,9 +1,5 @@
<RCC>
<qresource prefix="/">
<file>main.qml</file>
<file>styles/+material/Style.qml</file>
<file>styles/+universal/Style.qml</file>
<file>styles/Style.qml</file>
<file>Controls.qml</file>
</qresource>
</RCC>

View File

@ -1,8 +0,0 @@
import Qt.labs.controls.material 1.0
import "../.."
Controls {
color: Material.backgroundColor
Material.theme: themeSwitch.checked ? Material.Dark : Material.Light
}

View File

@ -1,9 +0,0 @@
import Qt.labs.controls.universal 1.0
import "../.."
Controls {
color: Universal.backgroundColor
Universal.theme: themeSwitch.checked ? Universal.Dark : Universal.Light
}

View File

@ -1,12 +0,0 @@
import Qt.labs.controls 1.0
import ".."
Controls {
color: Theme.backgroundColor
Theme.backgroundColor: themeSwitch.checked ? "#444" : "#fff"
Theme.frameColor: themeSwitch.checked ? "#666" : "#ccc"
Theme.textColor: themeSwitch.checked ? "#eee" : "#111"
Theme.pressColor: themeSwitch.checked ? "#33ffffff" : "#33333333"
Theme.baseColor: themeSwitch.checked ? "#444" : "#eee"
}