diff options
Diffstat (limited to 'tests/manual/quickcontrols/testbench/controls')
36 files changed, 1223 insertions, 0 deletions
diff --git a/tests/manual/quickcontrols/testbench/controls/BusyIndicator.qml b/tests/manual/quickcontrols/testbench/controls/BusyIndicator.qml new file mode 100644 index 0000000000..c61c100668 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/BusyIndicator.qml @@ -0,0 +1,18 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ["mirrored"] + ] + + property Component component: BusyIndicator { + enabled: !is("disabled") + LayoutMirroring.enabled: is("mirrored") + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/Button.qml b/tests/manual/quickcontrols/testbench/controls/Button.qml new file mode 100644 index 0000000000..1dcf05da36 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/Button.qml @@ -0,0 +1,66 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ["pressed"], + ["checkable", "checked"], + ["checkable", "checked", "disabled"], + ["checkable", "checked"], + ["highlighted"], + ["highlighted", "disabled"], + ["highlighted", "pressed"], + ["highlighted", "checkable"], + ["highlighted", "checkable", "pressed"], + ["highlighted", "checkable", "checked"], + ["icon"], + ["icon", "disabled"], + ["icon", "pressed"], + ["icon", "checkable", "checked"], + ["icon", "checkable", "checked", "disabled"], + ["icon", "checkable", "checked"], + ["icon", "highlighted"], + ["icon", "highlighted", "disabled"], + ["icon", "highlighted", "pressed"], + ["icon", "highlighted", "checkable"], + ["icon", "highlighted", "checkable", "pressed"], + ["icon", "highlighted", "checkable", "checked"], + ["flat"], + ["flat", "disabled"], + ["flat", "pressed"], + ["flat", "checkable"], + ["flat", "checkable", "checked"], + ["flat", "checkable", "pressed"], + ["flat", "checkable", "checked", "pressed"], + ["flat", "checkable", "highlighted"], + ["flat", "checkable", "highlighted", "pressed"], + ["flat", "checkable", "highlighted", "checked"], + ["icon", "flat"], + ["icon", "flat", "disabled"], + ["icon", "flat", "pressed"], + ["icon", "flat", "checkable"], + ["icon", "flat", "checkable", "checked"], + ["icon", "flat", "checkable", "pressed"], + ["icon", "flat", "checkable", "checked", "pressed"], + ["icon", "flat", "checkable", "highlighted"], + ["icon", "flat", "checkable", "highlighted", "pressed"], + ["icon", "flat", "checkable", "highlighted", "checked"] + ] + + property Component component: Button { + text: "Button" + enabled: !is("disabled") + flat: is("flat") + checkable: is("checkable") + checked: is("checked") + // Only set it if it's pressed, or the non-pressed examples will have no press effects + down: is("pressed") ? true : undefined + highlighted: is("highlighted") + icon.source: is("icon") ? "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/check.png" : "" + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/CheckBox.qml b/tests/manual/quickcontrols/testbench/controls/CheckBox.qml new file mode 100644 index 0000000000..4973033a4d --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/CheckBox.qml @@ -0,0 +1,27 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ["pressed"], + ["checked"], + ["checked", "disabled"], + ["checked", "pressed"], + ["partially-checked"], + ["partially-checked", "disabled"], + ["partially-checked", "pressed"], + ] + + property Component component: CheckBox { + text: "CheckBox" + enabled: !is("disabled") + checkState: is("checked") ? Qt.Checked : is("partially-checked") ? Qt.PartiallyChecked : Qt.Unchecked + // Only set it if it's pressed, or the non-pressed examples will have no press effects + down: is("pressed") ? true : undefined + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/CheckDelegate.qml b/tests/manual/quickcontrols/testbench/controls/CheckDelegate.qml new file mode 100644 index 0000000000..d64339501f --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/CheckDelegate.qml @@ -0,0 +1,40 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ["pressed"], + ["checked"], + ["checked", "disabled"], + ["checked", "pressed"], + ["partially-checked"], + ["partially-checked", "disabled"], + ["partially-checked", "pressed"], + ] + + property Component component: CheckDelegate { + text: "CheckDelegate" + enabled: !is("disabled") + checkState: is("checked") ? Qt.Checked : is("partially-checked") ? Qt.PartiallyChecked : Qt.Unchecked + // Only set it if it's pressed, or the non-pressed examples will have no press effects + down: is("pressed") ? true : undefined + focusPolicy: Qt.StrongFocus + } + + property Component exampleComponent: ListView { + implicitWidth: 200 + implicitHeight: 200 + clip: true + model: 20 + delegate: CheckDelegate { + width: parent.width + text: "CheckDelegate" + focusPolicy: Qt.StrongFocus + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/ComboBox.qml b/tests/manual/quickcontrols/testbench/controls/ComboBox.qml new file mode 100644 index 0000000000..39b8579630 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/ComboBox.qml @@ -0,0 +1,24 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ["pressed"], + ["open"], + ["editable"], + ["editable", "disabled"] + ] + + property Component component: ComboBox { + enabled: !is("disabled") + // Only set it if it's pressed, or the non-pressed examples will have no press effects + down: is("pressed") ? true : undefined + editable: is("editable") + model: ["ComboBox", "Apple", "Bird", "Cat", "Dog", "Elephant"] + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/DelayButton.qml b/tests/manual/quickcontrols/testbench/controls/DelayButton.qml new file mode 100644 index 0000000000..1c36a4f7ca --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/DelayButton.qml @@ -0,0 +1,24 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ["disabled", "checked"], + ["pressed"], + ["checked"], + ] + + property Component component: Component { + DelayButton { + text: "DelayButton" + enabled: !is("disabled") + // Only set it if it's pressed, or the non-pressed examples will have no press effects + down: is("pressed") ? true : undefined + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/Dial.qml b/tests/manual/quickcontrols/testbench/controls/Dial.qml new file mode 100644 index 0000000000..c4847ac886 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/Dial.qml @@ -0,0 +1,18 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + // TODO: no down property to test this with +// ["pressed"] + ] + + property Component component: Dial { + enabled: !is("disabled") + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/Dialog.qml b/tests/manual/quickcontrols/testbench/controls/Dialog.qml new file mode 100644 index 0000000000..1a25fbdfb9 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/Dialog.qml @@ -0,0 +1,40 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +// TODO +QtObject { + property string customControlName: qsTr("Dialog") + + property var supportedStates: [ + [], + ["modal"], + ["dim"] + ] + + property Component component: Button { + id: dialogButton + text: qsTr("Dialog") + hoverEnabled: true + + onClicked: dialog.open() + + Dialog { + id: dialog + x: (window.width - width) / 2 + y: (window.height - height) / 2 + standardButtons: Dialog.Ok | Dialog.Cancel + parent: window.contentItem + modal: is("modal") + dim: is("dim") || is("modal") + + Label { + text: "Lorem ipsum dolor sit amet, \nconsectetuer adipiscing elit, \n" + + "sed diam nonummy nibh euismod tincidunt ut \nlaoreet dolore magna aliquam erat volutpat." + } + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/Frame.qml b/tests/manual/quickcontrols/testbench/controls/Frame.qml new file mode 100644 index 0000000000..a57cb76f18 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/Frame.qml @@ -0,0 +1,17 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ] + + property Component component: Frame { + Label { + text: "Frame" + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/GroupBox.qml b/tests/manual/quickcontrols/testbench/controls/GroupBox.qml new file mode 100644 index 0000000000..23c938ff21 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/GroupBox.qml @@ -0,0 +1,19 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ] + + property Component component: GroupBox { + title: qsTr("Title") + + Label { + text: qsTr("GroupBox") + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/ItemDelegate.qml b/tests/manual/quickcontrols/testbench/controls/ItemDelegate.qml new file mode 100644 index 0000000000..e8171c36bc --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/ItemDelegate.qml @@ -0,0 +1,37 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ["pressed"], + ["highlighted"], + ["highlighted", "pressed"] + ] + + property Component component: ItemDelegate { + text: "ItemDelegate" + enabled: !is("disabled") + checkable: is("checkable") + // Only set it if it's pressed, or the non-pressed examples will have no press effects + down: is("pressed") ? true : undefined + highlighted: is("highlighted") + focusPolicy: Qt.StrongFocus + } + + property Component exampleComponent: ListView { + implicitWidth: 200 + implicitHeight: 200 + clip: true + model: 20 + delegate: ItemDelegate { + width: parent.width + text: "ItemDelegate" + focusPolicy: Qt.StrongFocus + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/Label.qml b/tests/manual/quickcontrols/testbench/controls/Label.qml new file mode 100644 index 0000000000..a5074e8faf --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/Label.qml @@ -0,0 +1,19 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"] + ] + + property Component component: Label { + text: "Label with a <a href=\"http://doc.qt.io\">link</a>" + onTextChanged: print(text) + enabled: !is("disabled") + textFormat: Label.StyledText + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/Menu.qml b/tests/manual/quickcontrols/testbench/controls/Menu.qml new file mode 100644 index 0000000000..aeadee4f86 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/Menu.qml @@ -0,0 +1,87 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +// TODO +QtObject { + property string customControlName: qsTr("Menu, MenuItem & MenuSeparator") + + property var supportedStates: [ + [] + ] + + property Component component: Button { + id: menuButton + text: qsTr("Menu") + checked: menu.visible + checkable: true + + Menu { + id: menu + x: 1 + y: 1 + parent.height + visible: menuButton.checked + closePolicy: Popup.CloseOnPressOutsideParent + + MenuItem { + text: "Normal" + } + MenuItem { + text: "Pressed" + down: true + } + MenuItem { + text: "Disabled" + enabled: false + } + + MenuSeparator {} + + MenuItem { + text: "Checked" + checked: true + } + MenuItem { + text: "Checked + Pressed" + checked: true + down: true + } + MenuItem { + text: "Checked + Disabled" + checked: true + enabled: false + } + + MenuSeparator {} + + Menu { + title: "Submenu" + + MenuItem { + text: "Submenu item" + } + } + + Menu { + title: "Submenu with icon" + icon { + width: 14 + height: 14 + source: "qrc:/qt-project.org/imports/QtQuick/Controls/Basic/images/double-arrow.png" + } + + MenuItem { + text: "Submenu item" + } + } + + Menu { + title: "Disabled Submenu" + enabled: false + } + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/MenuBar.qml b/tests/manual/quickcontrols/testbench/controls/MenuBar.qml new file mode 100644 index 0000000000..bed6fbd909 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/MenuBar.qml @@ -0,0 +1,32 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +// TODO +QtObject { + property string customControlName: qsTr("MenuBar & MenuBarItem") + + property var supportedStates: [ + [] + ] + + property Component component: MenuBar { + MenuBarItem { + text: qsTr("Normal") + } + MenuBarItem { + text: qsTr("Pressed") + down: true + } + MenuBarItem { + text: qsTr("Highlighted") + highlighted: true + } + MenuBarItem { + text: qsTr("Disabled") + enabled: false + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/Page.qml b/tests/manual/quickcontrols/testbench/controls/Page.qml new file mode 100644 index 0000000000..d8c29a7fe4 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/Page.qml @@ -0,0 +1,21 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ] + + property Component component: Page { + width: 100 + height: 100 + + Label { + text: "Page" + anchors.centerIn: parent + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/PageIndicator.qml b/tests/manual/quickcontrols/testbench/controls/PageIndicator.qml new file mode 100644 index 0000000000..34a242a6af --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/PageIndicator.qml @@ -0,0 +1,64 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + // TODO: no down property to test this with +// ["pressed"] + ] + + property Component component: PageIndicator { + enabled: !is("disabled") + count: 5 + } + + property Component exampleComponent: ColumnLayout { + implicitWidth: 200 + implicitHeight: 200 + + // TODO: why doesn't this fill the ColumnLayout? :/ + StackLayout { + id: swipeView + currentIndex: pageIndicator.currentIndex + + Label { + text: qsTr("Page 1") + horizontalAlignment: Label.AlignHCenter + } + + Label { + text: qsTr("Page 2") + horizontalAlignment: Label.AlignHCenter + } + + Label { + text: qsTr("Page 3") + horizontalAlignment: Label.AlignHCenter + } + + Label { + text: qsTr("Page 4") + horizontalAlignment: Label.AlignHCenter + } + + Label { + text: qsTr("Page 5") + horizontalAlignment: Label.AlignHCenter + } + } + + PageIndicator { + id: pageIndicator + currentIndex: swipeView.currentIndex + count: swipeView.count + interactive: true + anchors.horizontalCenter: parent.horizontalCenter + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/Pane.qml b/tests/manual/quickcontrols/testbench/controls/Pane.qml new file mode 100644 index 0000000000..9f60bec588 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/Pane.qml @@ -0,0 +1,21 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ] + + property Component component: Pane { + width: 100 + height: 100 + + Label { + text: "Pane" + anchors.centerIn: parent + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/ProgressBar.qml b/tests/manual/quickcontrols/testbench/controls/ProgressBar.qml new file mode 100644 index 0000000000..bd4ab8e379 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/ProgressBar.qml @@ -0,0 +1,19 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ["indeterminate"] + ] + + property Component component: ProgressBar { + enabled: !is("disabled") + indeterminate: is("indeterminate") + value: 0.25 + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/RadioButton.qml b/tests/manual/quickcontrols/testbench/controls/RadioButton.qml new file mode 100644 index 0000000000..00beb1bac9 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/RadioButton.qml @@ -0,0 +1,26 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ["pressed"], + ["checked"], + ["checked", "disabled"], + ["checked", "pressed"], + ] + + property Component component: Component { + RadioButton { + text: "RadioButton" + enabled: !is("disabled") + checked: is("checked") + // Only set it if it's pressed, or the non-pressed examples will have no press effects + down: is("pressed") ? true : undefined + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/RadioDelegate.qml b/tests/manual/quickcontrols/testbench/controls/RadioDelegate.qml new file mode 100644 index 0000000000..4dab387fcf --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/RadioDelegate.qml @@ -0,0 +1,39 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ["pressed"], + ["checked"], + ["checked", "disabled"], + ["checked", "pressed"] + ] + + property Component component: Component { + RadioDelegate { + text: "RadioDelegate" + enabled: !is("disabled") + checked: is("checked") + // Only set it if it's pressed, or the non-pressed examples will have no press effects + down: is("pressed") ? true : undefined + focusPolicy: Qt.StrongFocus + } + } + + property Component exampleComponent: ListView { + implicitWidth: 200 + implicitHeight: 200 + clip: true + model: 20 + delegate: RadioDelegate { + width: parent.width + text: "RadioDelegate" + focusPolicy: Qt.StrongFocus + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/RangeSlider.qml b/tests/manual/quickcontrols/testbench/controls/RangeSlider.qml new file mode 100644 index 0000000000..18a2418451 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/RangeSlider.qml @@ -0,0 +1,22 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + ["vertical"], + ["vertical", "disabled"], + ["vertical", "pressed"], + ["horizontal"], + ["horizontal", "disabled"], + ["horizontal", "pressed"] + ] + + property Component component: RangeSlider { + enabled: !is("disabled") + orientation: is("horizontal") ? Qt.Horizontal : Qt.Vertical + second.value: 0.5 + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/RoundButton.qml b/tests/manual/quickcontrols/testbench/controls/RoundButton.qml new file mode 100644 index 0000000000..530aaee338 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/RoundButton.qml @@ -0,0 +1,41 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ["pressed"], + ["checked"], + ["checked", "disabled"], + ["highlighted"], + ["highlighted", "disabled"], + ["highlighted", "pressed"], + ["highlighted", "checked"], + ["highlighted", "checkable", "pressed"], + ["highlighted", "checkable", "checked"], + ["flat"], + ["flat", "disabled"], + ["flat", "pressed"], + ["flat", "checked"], + ["flat", "checkable"], + ["flat", "checkable", "pressed"], + ["flat", "checkable", "checked", "pressed"], + ["flat", "checkable", "highlighted"], + ["flat", "checkable", "highlighted", "pressed"], + ["flat", "checkable", "highlighted", "checked"] + ] + + property Component component: RoundButton { + text: "B" + enabled: !is("disabled") + flat: is("flat") + checkable: is("checkable") + // Only set it if it's pressed, or the non-pressed examples will have no press effects + down: is("pressed") ? true : undefined + highlighted: is("highlighted") + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/ScrollBar.qml b/tests/manual/quickcontrols/testbench/controls/ScrollBar.qml new file mode 100644 index 0000000000..5fa00fec0f --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/ScrollBar.qml @@ -0,0 +1,67 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + ["vertical"], + ["vertical", "disabled"], + ["vertical", "interactive"], + ["vertical", "interactive", "disabled"], + ["horizontal"], + ["horizontal", "disabled"], + ["horizontal", "interactive"], + ["horizontal", "interactive", "disabled"] + ] + + property Component component: Frame { + width: 100 + height: 100 + clip: true + + Label { + text: "ABCDEFG\nHIJKLMN" + font.pixelSize: 40 + x: -horizontalScrollBar.position * width + y: -verticalScrollBar.position * height + } + + ScrollBar { + id: verticalScrollBar + enabled: !is("disabled") + orientation: Qt.Vertical + interactive: is("interactive") + visible: is("vertical") + size: 0.3 + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + + Binding { + target: verticalScrollBar + property: "active" + value: verticalScrollBar.visible + } + } + + ScrollBar { + id: horizontalScrollBar + enabled: !is("disabled") + orientation: Qt.Horizontal + interactive: is("interactive") + visible: is("horizontal") + size: 0.3 + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + + Binding { + target: horizontalScrollBar + property: "active" + value: horizontalScrollBar.visible + } + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/ScrollIndicator.qml b/tests/manual/quickcontrols/testbench/controls/ScrollIndicator.qml new file mode 100644 index 0000000000..5c0c0d4edc --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/ScrollIndicator.qml @@ -0,0 +1,57 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + ["vertical"], + ["vertical", "disabled"], + ["horizontal"], + ["horizontal", "disabled"], + ] + + property Component component: Frame { + width: 100 + height: 100 + clip: true + + Label { + text: "ABCDEFG\nHIJKLMN" + font.pixelSize: 40 + x: horizontalScrollIndicator.position * width + y: verticalScrollIndicator.position * height + } + + ScrollIndicator { + id: verticalScrollIndicator + enabled: !is("disabled") + orientation: Qt.Vertical + active: true + visible: is("vertical") + size: 0.3 + anchors.right: parent.right + anchors.top: parent.top + anchors.bottom: parent.bottom + } + + ScrollIndicator { + id: horizontalScrollIndicator + enabled: !is("disabled") + orientation: Qt.Horizontal + active: true + visible: is("horizontal") + size: 0.3 + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + + Binding { + target: horizontalScrollIndicator + property: "active" + value: horizontalScrollIndicator.visible + } + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/Slider.qml b/tests/manual/quickcontrols/testbench/controls/Slider.qml new file mode 100644 index 0000000000..d35e8fe0fa --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/Slider.qml @@ -0,0 +1,22 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + ["vertical"], + ["vertical", "disabled"], + ["vertical", "pressed"], + ["horizontal"], + ["horizontal", "disabled"], + ["horizontal", "pressed"] + ] + + property Component component: Slider { + enabled: !is("disabled") + orientation: is("horizontal") ? Qt.Horizontal : Qt.Vertical + value: 0.5 + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/SpinBox.qml b/tests/manual/quickcontrols/testbench/controls/SpinBox.qml new file mode 100644 index 0000000000..06c6ca43ef --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/SpinBox.qml @@ -0,0 +1,31 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["pressed"], + ["disabled"], + ["mirrored"], + ["mirrored", "pressed"], + ["mirrored", "disabled"], + ["editable"], + ["editable", "pressed"], + ["editable", "disabled"], + ["editable", "mirrored"], + ["editable", "mirrored", "pressed"], + ["editable", "mirrored", "disabled"] + ] + + property Component component: SpinBox { + value: 1 + enabled: !is("disabled") + editable: is("editable") + up.pressed: is("pressed") + + LayoutMirroring.enabled: is("mirrored") + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/SplitView.qml b/tests/manual/quickcontrols/testbench/controls/SplitView.qml new file mode 100644 index 0000000000..c51ac846f2 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/SplitView.qml @@ -0,0 +1,32 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [] + ] + + property Component component: SplitView { + implicitWidth: 400 + implicitHeight: 100 + + Rectangle { + color: "salmon" + implicitWidth: 25 + implicitHeight: 25 + } + Rectangle { + color: "navajowhite" + implicitWidth: 100 + implicitHeight: 100 + } + Rectangle { + color: "steelblue" + implicitWidth: 200 + implicitHeight: 200 + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/SwipeDelegate.qml b/tests/manual/quickcontrols/testbench/controls/SwipeDelegate.qml new file mode 100644 index 0000000000..e04f0bb630 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/SwipeDelegate.qml @@ -0,0 +1,59 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ["pressed"], + ["highlighted"], + ["highlighted", "pressed"] + ] + + property Component actionComponent: Component { + Rectangle { + color: SwipeDelegate.pressed ? "#333" : "#444" + width: parent ? parent.width : 0 + height: parent ? parent.height: 0 + clip: true + + Label { + text: "Test" + color: "white" + anchors.centerIn: parent + } + } + } + + property Component component: SwipeDelegate { + id: swipeDelegate + text: "SwipeDelegate" + enabled: !is("disabled") + checkable: is("checkable") + // Only set it if it's pressed, or the non-pressed examples will have no press effects + down: is("pressed") ? true : undefined + highlighted: is("highlighted") + focusPolicy: Qt.StrongFocus + + swipe.left: actionComponent + swipe.right: actionComponent + } + + property Component exampleComponent: ListView { + implicitWidth: 200 + implicitHeight: 200 + clip: true + model: 20 + delegate: SwipeDelegate { + width: parent.width + text: "SwipeDelegate" + focusPolicy: Qt.StrongFocus + + swipe.left: actionComponent + swipe.right: actionComponent + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/Switch.qml b/tests/manual/quickcontrols/testbench/controls/Switch.qml new file mode 100644 index 0000000000..c7e5103183 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/Switch.qml @@ -0,0 +1,29 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ["pressed"], + ["checked"], + ["checked", "disabled"], + ["checked", "disabled", "mirrored"], + ["checked", "pressed"], + ["checked", "pressed", "mirrored"], + ["mirrored"], + ] + + property Component component: Switch { + text: "Switch" + enabled: !is("disabled") + checked: is("checked") + // Only set it if it's pressed, or the non-pressed examples will have no press effects + down: is("pressed") ? true : undefined + + LayoutMirroring.enabled: is("mirrored") + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/SwitchDelegate.qml b/tests/manual/quickcontrols/testbench/controls/SwitchDelegate.qml new file mode 100644 index 0000000000..9508b2ce80 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/SwitchDelegate.qml @@ -0,0 +1,39 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ["pressed"], + ["highlighted"], + ["highlighted", "pressed"], + ["mirrored"] + ] + + property Component component: SwitchDelegate { + text: "SwitchDelegate" + enabled: !is("disabled") + // Only set it if it's pressed, or the non-pressed examples will have no press effects + down: is("pressed") ? true : undefined + highlighted: is("highlighted") + focusPolicy: Qt.StrongFocus + + LayoutMirroring.enabled: is("mirrored") + } + + property Component exampleComponent: ListView { + implicitWidth: 200 + implicitHeight: 200 + clip: true + model: 20 + delegate: SwitchDelegate { + width: parent.width + text: "SwitchDelegate" + focusPolicy: Qt.StrongFocus + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/TabBar.qml b/tests/manual/quickcontrols/testbench/controls/TabBar.qml new file mode 100644 index 0000000000..e0286146f9 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/TabBar.qml @@ -0,0 +1,34 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +// TODO +QtObject { + property string customControlName: qsTr("TabBar & TabButton") + + property var supportedStates: [ + ["header"], + ["header", "disabled"], + ["footer"], + ["footer", "disabled"] + ] + + property Component component: TabBar { + implicitHeight: tabButton1.implicitHeight + enabled: !is("disabled") + position: is("header") ? TabBar.Header : TabBar.Footer + + TabButton { + id: tabButton1 + text: qsTr("TabButton 1") + } + TabButton { + text: qsTr("TabButton 2") + } + TabButton { + text: qsTr("TabButton 3") + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/TextArea.qml b/tests/manual/quickcontrols/testbench/controls/TextArea.qml new file mode 100644 index 0000000000..3b76ef2b0a --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/TextArea.qml @@ -0,0 +1,26 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ] + + property Component component: Column { + spacing: 10 + + TextArea { + text: "TextArea\nwith\ntext" + enabled: !is("disabled") + } + + TextArea { + placeholderText: "TextArea with placeholderText" + enabled: !is("disabled") + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/TextField.qml b/tests/manual/quickcontrols/testbench/controls/TextField.qml new file mode 100644 index 0000000000..205418f08c --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/TextField.qml @@ -0,0 +1,26 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls + +QtObject { + property var supportedStates: [ + [], + ["disabled"], + ] + + property Component component: Column { + spacing: 10 + + TextField { + text: "TextField with text" + enabled: !is("disabled") + } + + TextField { + placeholderText: "TextField with placeholderText" + enabled: !is("disabled") + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/ToolBar.qml b/tests/manual/quickcontrols/testbench/controls/ToolBar.qml new file mode 100644 index 0000000000..1fccb74e65 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/ToolBar.qml @@ -0,0 +1,40 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +// TODO +QtObject { + property string customControlName: qsTr("ToolBar, ToolButton & ToolSeparator") + + property var supportedStates: [ + ["header"], + ["header", "disabled"], + ["footer"], + ["footer", "disabled"] + ] + + property Component component: ToolBar { + enabled: !is("disabled") + position: is("header") ? ToolBar.Header : ToolBar.Footer + + RowLayout { + anchors.fill: parent + + ToolButton { + text: qsTr("ToolButton 1") + } + ToolButton { + text: qsTr("ToolButton 2") + } + + ToolSeparator {} + + ToolButton { + text: qsTr("ToolButton 3") + } + } + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/ToolTip.qml b/tests/manual/quickcontrols/testbench/controls/ToolTip.qml new file mode 100644 index 0000000000..de8f117429 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/ToolTip.qml @@ -0,0 +1,20 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +QtObject { + property var supportedStates: [ + [] + ] + + property Component component: Button { + text: qsTr("Hover over me") + + ToolTip.text: qsTr("ToolTip") + ToolTip.visible: hovered + ToolTip.delay: 500 + } +} diff --git a/tests/manual/quickcontrols/testbench/controls/Tumbler.qml b/tests/manual/quickcontrols/testbench/controls/Tumbler.qml new file mode 100644 index 0000000000..1c571d22b1 --- /dev/null +++ b/tests/manual/quickcontrols/testbench/controls/Tumbler.qml @@ -0,0 +1,20 @@ +// Copyright (C) 2017 The Qt Company Ltd. +// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR BSD-3-Clause + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +QtObject { + property var supportedStates: [ + [], + ["disabled"] + ] + + property Component component: Tumbler { + model: 20 + enabled: !is("disabled") + + LayoutMirroring.enabled: is("mirrored") + } +} |