aboutsummaryrefslogtreecommitdiffstats
path: root/tests/manual
diff options
context:
space:
mode:
authorMitch Curtis <mitch.curtis@qt.io>2017-09-25 11:38:08 +0200
committerMitch Curtis <mitch.curtis@qt.io>2017-09-25 12:03:29 +0000
commitf2e06ce60a8822d844221e77ca0a66f690855452 (patch)
tree5bee0ccb455abd0e832df21cf69839f1bfe56dfe /tests/manual
parent1b05920e53e377e271cad5476e352ce6a28c03e2 (diff)
Replace testbench with newer "style testbench"
The style testbench was developed to provide a way for designers to test out their Imagine style assets, but since it is now more feature-rich than the old testbench, it seems like a good idea to replace it. The tool is described in README.md. Change-Id: I9abec1bc294fd176e2255e067af280b378961551 Reviewed-by: J-P Nurmi <jpnurmi@qt.io>
Diffstat (limited to 'tests/manual')
-rw-r--r--tests/manual/testbench/.gitignore83
-rw-r--r--tests/manual/testbench/ColorEditor.qml80
-rw-r--r--tests/manual/testbench/ControlContainer.qml70
-rw-r--r--tests/manual/testbench/ExampleContainer.qml83
-rw-r--r--tests/manual/testbench/README.md34
-rw-r--r--tests/manual/testbench/SettingsDialog.qml423
-rw-r--r--tests/manual/testbench/assetfixer.cpp563
-rw-r--r--tests/manual/testbench/assetfixer.h126
-rw-r--r--tests/manual/testbench/clipboard.cpp124
-rw-r--r--tests/manual/testbench/clipboard.h72
-rw-r--r--tests/manual/testbench/controls/BusyIndicator.qml65
-rw-r--r--tests/manual/testbench/controls/Button.qml94
-rw-r--r--tests/manual/testbench/controls/CheckBox.qml74
-rw-r--r--tests/manual/testbench/controls/CheckDelegate.qml85
-rw-r--r--tests/manual/testbench/controls/ComboBox.qml71
-rw-r--r--tests/manual/testbench/controls/DelayButton.qml72
-rw-r--r--tests/manual/testbench/controls/Dial.qml65
-rw-r--r--tests/manual/testbench/controls/Dialog.qml83
-rw-r--r--tests/manual/testbench/controls/Frame.qml64
-rw-r--r--tests/manual/testbench/controls/GroupBox.qml66
-rw-r--r--tests/manual/testbench/controls/ItemDelegate.qml82
-rw-r--r--tests/manual/testbench/controls/Label.qml66
-rw-r--r--tests/manual/testbench/controls/Menu.qml121
-rw-r--r--tests/manual/testbench/controls/Page.qml68
-rw-r--r--tests/manual/testbench/controls/PageIndicator.qml111
-rw-r--r--tests/manual/testbench/controls/Pane.qml68
-rw-r--r--tests/manual/testbench/controls/ProgressBar.qml66
-rw-r--r--tests/manual/testbench/controls/RadioButton.qml73
-rw-r--r--tests/manual/testbench/controls/RadioDelegate.qml84
-rw-r--r--tests/manual/testbench/controls/RangeSlider.qml69
-rw-r--r--tests/manual/testbench/controls/RoundButton.qml94
-rw-r--r--tests/manual/testbench/controls/ScrollBar.qml114
-rw-r--r--tests/manual/testbench/controls/ScrollIndicator.qml104
-rw-r--r--tests/manual/testbench/controls/Slider.qml69
-rw-r--r--tests/manual/testbench/controls/SpinBox.qml76
-rw-r--r--tests/manual/testbench/controls/SwipeDelegate.qml104
-rw-r--r--tests/manual/testbench/controls/Switch.qml76
-rw-r--r--tests/manual/testbench/controls/SwitchDelegate.qml84
-rw-r--r--tests/manual/testbench/controls/TabBar.qml81
-rw-r--r--tests/manual/testbench/controls/TextArea.qml63
-rw-r--r--tests/manual/testbench/controls/TextField.qml64
-rw-r--r--tests/manual/testbench/controls/ToolBar.qml87
-rw-r--r--tests/manual/testbench/controls/ToolTip.qml67
-rw-r--r--tests/manual/testbench/controls/Tumbler.qml67
-rw-r--r--tests/manual/testbench/directoryvalidator.cpp102
-rw-r--r--tests/manual/testbench/directoryvalidator.h84
-rw-r--r--tests/manual/testbench/fonts.qrc5
-rwxr-xr-xtests/manual/testbench/fonts/LICENSE.txt12
-rwxr-xr-xtests/manual/testbench/fonts/fontawesome.ttfbin0 -> 5464 bytes
-rw-r--r--tests/manual/testbench/main.cpp33
-rw-r--r--tests/manual/testbench/qml.qrc38
-rw-r--r--tests/manual/testbench/testbench.pro15
-rw-r--r--tests/manual/testbench/testbench.qml1266
53 files changed, 4970 insertions, 940 deletions
diff --git a/tests/manual/testbench/.gitignore b/tests/manual/testbench/.gitignore
new file mode 100644
index 00000000..75fae8bc
--- /dev/null
+++ b/tests/manual/testbench/.gitignore
@@ -0,0 +1,83 @@
+testbench
+*.png
+*.so
+*.so.*
+*.app
+*.exe
+*.dll
+*.dylib
+*.lib
+*.exp
+*.a
+*.la
+*.core
+*.moc
+*.o
+*.obj
+*.orig
+*.swp
+*.rej
+*.so
+*.pbxuser
+*.mode1
+*.mode1v3
+*_pch.h.cpp
+*_resource.rc
+*~
+.#*
+*.*#
+.qmake.stash
+.qmake.cache
+.qmake.vars
+*.prl
+tags
+.DS_Store
+*.debug
+Makefile*
+*.Debug
+*.Release
+*.prl
+*.pro.user
+*.qmlproject.user*
+moc_*.h
+moc_*.cpp
+ui_*.h
+qrc_*.cpp
+callgrind.out.*
+pcviewer.cfg
+*.flc
+.*.swp
+*.ib_pdb_index
+*.idb
+*.ilk
+*.pdb
+*.sln
+*.suo
+*.vcproj
+*vcproj.*.*.user
+*.ncb
+.pch
+.rcc
+.project
+.cproject
+.make.cache
+android-build
+app_process
+qtc-debugging-helper
+android-*.so-deployment-settings.json
+*.directory
+*_plugin_import.cpp
+*_wrapper.sh
+*_wrapper.bat
+*.mak
+*.xib
+*.plist
+*.pbxproj
+*_plugin_import.cpp
+*.xcsettings
+*.xcscheme
+*.xcodeproj
+qt.conf
+*.version
+*.version.in
+*.qmlc
diff --git a/tests/manual/testbench/ColorEditor.qml b/tests/manual/testbench/ColorEditor.qml
new file mode 100644
index 00000000..83f8f2b0
--- /dev/null
+++ b/tests/manual/testbench/ColorEditor.qml
@@ -0,0 +1,80 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.3
+
+RowLayout {
+ property alias labelText: label.text
+ property string toolTipText
+ property alias color: textField.text
+
+ ToolTip.text: toolTipText
+ ToolTip.visible: textField.hovered
+
+ Layout.columnSpan: 2
+
+ Label {
+ id: label
+
+ Layout.fillWidth: true
+ }
+
+ TextField {
+ id: textField
+
+ validator: RegExpValidator{
+ regExp: /#?[0-9a-fA-F]*/
+ }
+
+ Layout.preferredWidth: 200
+ }
+}
diff --git a/tests/manual/testbench/ControlContainer.qml b/tests/manual/testbench/ControlContainer.qml
new file mode 100644
index 00000000..b6bd8542
--- /dev/null
+++ b/tests/manual/testbench/ControlContainer.qml
@@ -0,0 +1,70 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+
+Item {
+ id: container
+
+ implicitWidth: delegate.implicitWidth
+ implicitHeight: delegate.implicitHeight
+
+ property var controlMetaObject
+ property var states
+
+ Loader {
+ id: delegate
+ sourceComponent: controlMetaObject ? controlMetaObject.component : null
+
+ function is(state) {
+ return container.states.indexOf(state) !== -1
+ }
+ }
+}
diff --git a/tests/manual/testbench/ExampleContainer.qml b/tests/manual/testbench/ExampleContainer.qml
new file mode 100644
index 00000000..ffada686
--- /dev/null
+++ b/tests/manual/testbench/ExampleContainer.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.3
+
+Frame {
+ id: container
+
+ property var controlMetaObject
+
+ ColumnLayout {
+ id: exampleLayout
+ anchors.centerIn: parent
+
+ Label {
+ text: !exampleLoader.active ? qsTr("Show example") : qsTr("Hide example")
+
+ Layout.alignment: Qt.AlignHCenter
+
+ MouseArea {
+ anchors.fill: parent
+ onClicked: exampleLoader.active = !exampleLoader.active
+ }
+ }
+
+ Loader {
+ id: exampleLoader
+ active: false
+ sourceComponent: controlMetaObject ? controlMetaObject.exampleComponent : null
+
+ Layout.preferredHeight: active ? item.implicitHeight : 0
+ }
+ }
+}
diff --git a/tests/manual/testbench/README.md b/tests/manual/testbench/README.md
new file mode 100644
index 00000000..2d7fa54a
--- /dev/null
+++ b/tests/manual/testbench/README.md
@@ -0,0 +1,34 @@
+# Style Testbench
+
+The Style Testbench provides a way to quickly see how controls look in different states with a given style.
+
+When run with the Imagine style, the testbench will react to changes to image assets and automatically fix and reload them.
+To use this functionality, click on the settings icon and then the settings menu item.
+From there, check "Use Custom Imagine Style Assets" and provide a path to your custom assets in the text field.
+If you want your 9-patch assets to be automatically fixed up (e.g. turn 4 pixel-thick 9-patch lines exported at
+@4x to a 1 pixel-thick line), check "Fix Imagine Style Assets".
+
+## Custom Text colors
+
+To use custom text colors, enable the "Use Custom Palette" option in the settings dialog, and then provide colors in the relevant fields. As an example, the WindowText palette role affects text that is displayed directly against the window (labels, flat button text, etc.), ButtonText affects text that is displayed against a button's background, and so on. A full list of color roles can be found here:
+
+http://doc.qt.io/qt-5/qpalette.html#ColorRole-enum
+
+The custom text color settings apply to every style that supports palettes, until turned off.
+
+The "Copy Palette Settings To Clipboard" button in the settings dialog can be used to copy the current colors and share them with others. Once someone has your custom colors, they can import them with the "Imort Palette Settings From Clipboard" button.
+
+## Tips
+
+- Ensure that 9-patch lines are black (#000000) or red (#ff0000). If these colors are slightly
+ off (e.g. #010101), the assets won't display correctly when run in the application.
+- Don't use pure black in assets that have black 9-patch lines, as this will confuse the asset fixer.
+
+## Shortcuts
+
+| Name | Shortcut | Shortcut (Mac) | Description |
+|-------------------|--------------|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------|
+| Use Custom Assets | Ctrl+Shift+C | ⌘+Shift+C | If using the Imagine style, toggles between the default assets and the user's custom assets. Custom assets are specified in the settings dialog. |
+| Reload Assets | Ctrl+Shift+R | ⌘+R | If using the Imagine style, reloads the assets from disk. This is usually done automatically. |
+| Search/Filter | Ctrl+F | ⌘+F | Filter the controls that are shown. Case-sensitive. |
+| Quit | Ctrl+Q | ⌘+Q | Quit the application. |
diff --git a/tests/manual/testbench/SettingsDialog.qml b/tests/manual/testbench/SettingsDialog.qml
new file mode 100644
index 00000000..2bc3ddec
--- /dev/null
+++ b/tests/manual/testbench/SettingsDialog.qml
@@ -0,0 +1,423 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+import QtQuick.Controls.Imagine 2.3
+import QtQuick.Layouts 1.2
+
+import App 1.0
+
+Dialog {
+ id: settingsDialog
+ title: "Settings"
+ width: 500
+ height: 400
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+
+ Imagine.path: defaultImaginePath
+
+ property alias imaginePathTextField: imaginePathTextField
+ property alias customImagineStyleCheckBox: customImagineStyleCheckBox
+ property alias fixImagineAssetsCheckBox: fixImagineAssetsCheckBox
+
+ onAboutToShow: {
+ styleComboBox.currentIndex = styleComboBox.styleIndex
+ customImagineStyleCheckBox.checked = settings.useCustomImaginePath
+ imaginePathTextField.text = settings.imaginePath
+ fixImagineAssetsCheckBox.checked = settings.fixImagineAssets
+
+ updatePaletteSettingsControls(paletteSettings)
+ }
+
+ onAccepted: {
+ settings.style = styleComboBox.displayText
+ settings.useCustomImaginePath = customImagineStyleCheckBox.checked
+ settings.imaginePath = imaginePathTextField.text
+ settings.fixImagineAssets = fixImagineAssetsCheckBox.checked
+
+ paletteSettings.useCustomPalette = useCustomPaletteCheckBox.checked
+ paletteSettings.window = windowColorEditor.color
+ paletteSettings.windowText = windowTextColorEditor.color
+ paletteSettings.base = baseColorEditor.color
+ paletteSettings.text = textColorEditor.color
+ paletteSettings.button = buttonColorEditor.color
+ paletteSettings.buttonText = buttonTextColorEditor.color
+ paletteSettings.brightText = brightTextColorEditor.color
+ paletteSettings.toolTipBase = toolTipBaseColorEditor.color
+ paletteSettings.toolTipText = toolTipTextColorEditor.color
+ paletteSettings.light = lightColorEditor.color
+ paletteSettings.midlight = midlightColorEditor.color
+ paletteSettings.dark = darkColorEditor.color
+ paletteSettings.mid = midColorEditor.color
+ paletteSettings.shadow = shadowColorEditor.color
+ paletteSettings.highlight = highlightColorEditor.color
+ paletteSettings.highlightedText = highlightedTextColorEditor.color
+ paletteSettings.link = linkColorEditor.color
+ }
+
+ function updatePaletteSettingsControls(source) {
+ useCustomPaletteCheckBox.checked = paletteSettings.useCustomPalette
+ windowColorEditor.color = source.window
+ windowTextColorEditor.color = source.windowText
+ baseColorEditor.color = source.base
+ textColorEditor.color = source.text
+ buttonColorEditor.color = source.button
+ buttonTextColorEditor.color = source.buttonText
+ brightTextColorEditor.color = source.brightText
+ toolTipBaseColorEditor.color = source.toolTipBase
+ toolTipTextColorEditor.color = source.toolTipText
+ lightColorEditor.color = source.light
+ midlightColorEditor.color = source.midlight
+ darkColorEditor.color = source.dark
+ midColorEditor.color = source.mid
+ shadowColorEditor.color = source.shadow
+ highlightColorEditor.color = source.highlight
+ highlightedTextColorEditor.color = source.highlightedText
+ linkColorEditor.color = source.link
+ }
+
+ function paletteSettingsMap() {
+ var map = ({});
+ map.window = windowColorEditor.color
+ map.windowText = windowTextColorEditor.color
+ map.base = baseColorEditor.color
+ map.text = textColorEditor.color
+ map.button = buttonColorEditor.color
+ map.buttonText = buttonTextColorEditor.color
+ map.brightText = brightTextColorEditor.color
+ map.toolTipBase = toolTipBaseColorEditor.color
+ map.toolTipText = toolTipTextColorEditor.color
+ map.light = lightColorEditor.color
+ map.midlight = midlightColorEditor.color
+ map.dark = darkColorEditor.color
+ map.mid = midColorEditor.color
+ map.shadow = shadowColorEditor.color
+ map.highlight = highlightColorEditor.color
+ map.highlightedText = highlightedTextColorEditor.color
+ map.link = linkColorEditor.color
+ return map;
+ }
+
+ Clipboard {
+ id: clipboard
+ }
+
+ DirectoryValidator {
+ id: directoryValidator
+ path: imaginePathTextField.text
+ }
+
+ contentItem: Flickable {
+ contentWidth: settingsDialog.availableWidth
+ contentHeight: contentGridLayout.implicitHeight
+ flickableDirection: Qt.Vertical
+ clip: true
+
+ GridLayout {
+ id: contentGridLayout
+ columns: 2
+ anchors.fill: parent
+
+ Label {
+ text: "Style:"
+ }
+
+ ComboBox {
+ id: styleComboBox
+ model: availableStyles
+
+ property int styleIndex: -1
+
+ Component.onCompleted: {
+ styleIndex = find(settings.style, Qt.MatchFixedString)
+ if (styleIndex !== -1)
+ currentIndex = styleIndex
+ }
+
+ Layout.fillWidth: true
+ }
+
+ Item {
+ Layout.fillWidth: true
+ }
+
+ Label {
+ text: "Restart required"
+ color: "#e41e25"
+ opacity: styleComboBox.currentIndex !== styleComboBox.styleIndex ? 1.0 : 0.0
+ Layout.topMargin: 12
+ Layout.maximumHeight: styleComboBox.currentIndex !== styleComboBox.styleIndex ? implicitHeight : 0
+ }
+
+ CheckBox {
+ id: customImagineStyleCheckBox
+ text: qsTr("Use Custom Imagine Style Assets")
+ enabled: usingImagineStyle
+
+ Layout.columnSpan: 2
+ }
+
+ Label {
+ text: "Imagine Style Assets Path"
+ enabled: usingImagineStyle && customImagineStyleCheckBox.checked
+ }
+
+ TextField {
+ id: imaginePathTextField
+ text: settings.imaginePath
+ enabled: usingImagineStyle && customImagineStyleCheckBox.checked
+
+ Layout.preferredWidth: 200
+ Layout.fillWidth: true
+
+ ToolTip {
+ text: "Path to a folder that contains Imagine style image assets"
+ visible: imaginePathTextField.hovered
+ delay: 500
+ parent: imaginePathTextField
+
+ Imagine.path: defaultImaginePath
+ }
+ }
+
+ Item {
+ Layout.fillWidth: true
+ }
+
+ Label {
+ text: directoryValidator.errorMessage
+ color: "#e41e25"
+ opacity: !directoryValidator.valid ? 1.0 : 0.0
+ elide: Label.ElideMiddle
+ Layout.topMargin: !directoryValidator.valid ? 12 : 0
+ Layout.maximumHeight: !directoryValidator.valid ? implicitHeight : 0
+
+ Layout.fillWidth: true
+ }
+
+ CheckBox {
+ id: fixImagineAssetsCheckBox
+ text: "Fix Imagine Style Assets"
+ enabled: usingImagineStyle && customImagineStyleCheckBox.checked
+
+ Layout.columnSpan: 2
+
+ ToolTip {
+ text: "If set, custom Imagine style assets will be modified to be compliant"
+ visible: fixImagineAssetsCheckBox.hovered
+ delay: 500
+ parent: imaginePathTextField
+
+ Imagine.path: defaultImaginePath
+ }
+ }
+
+ CheckBox {
+ id: useCustomPaletteCheckBox
+ text: qsTr("Use Custom Palette")
+
+ Layout.topMargin: 12
+ }
+
+ ColorEditor {
+ id: windowColorEditor
+ labelText: qsTr("Window")
+ toolTipText: qsTr("A general background color.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: windowTextColorEditor
+ labelText: qsTr("WindowText")
+ toolTipText: qsTr("A general foreground color.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: baseColorEditor
+ labelText: qsTr("Base")
+ toolTipText: qsTr("Used mostly as the background color for text editor controls and items views. It is usually white or another light color.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: textColorEditor
+ labelText: qsTr("Text")
+ toolTipText: qsTr("The foreground color used with Base. This is usually the same as the WindowText, in which case it must provide good contrast with Window and Base.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: buttonColorEditor
+ labelText: qsTr("Button")
+ toolTipText: qsTr("The general button background color. This background can be different from Window as some styles require a different background color for buttons.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: buttonTextColorEditor
+ labelText: qsTr("ButtonText")
+ toolTipText: qsTr("A foreground color used with the Button color.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: brightTextColorEditor
+ labelText: qsTr("BrightText")
+ toolTipText: qsTr("A text color that is very different from WindowText, and contrasts well with e.g. Dark. Typically used for text that needs to be drawn where Text, WindowText or ButtonText would give poor contrast, such as on highlighted buttons.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: toolTipBaseColorEditor
+ labelText: qsTr("ToolTipBase")
+ toolTipText: qsTr("Used as the background color for tooltips.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: toolTipTextColorEditor
+ labelText: qsTr("ToolTipText")
+ toolTipText: qsTr("Used as the foreground color for tooltips.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: lightColorEditor
+ labelText: qsTr("Light")
+ toolTipText: qsTr("Lighter than Button.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: midlightColorEditor
+ labelText: qsTr("Midlight")
+ toolTipText: qsTr("Between Button and Light.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: darkColorEditor
+ labelText: qsTr("Dark")
+ toolTipText: qsTr("Darker than Button.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: midColorEditor
+ labelText: qsTr("Mid")
+ toolTipText: qsTr("Between Button and Dark.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: shadowColorEditor
+ labelText: qsTr("Shadow")
+ toolTipText: qsTr("A very dark color.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: highlightColorEditor
+ labelText: qsTr("Highlight")
+ toolTipText: qsTr("A color to indicate a selected item or the current item.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: linkColorEditor
+ labelText: qsTr("Link")
+ toolTipText: qsTr("A text color used for hyperlinks.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ ColorEditor {
+ id: highlightedTextColorEditor
+ labelText: qsTr("HighlightedText")
+ toolTipText: qsTr("A text color that contrasts with Highlight.")
+ enabled: useCustomPaletteCheckBox.checked
+ }
+
+ Button {
+ text: qsTr("Copy Palette Settings To Clipboard")
+ onClicked: clipboard.copy(paletteSettingsMap())
+
+ Layout.columnSpan: 2
+ Layout.alignment: Qt.AlignRight
+ }
+
+ Button {
+ text: qsTr("Import Palette Settings From Clipboard")
+ onClicked: updatePaletteSettingsControls(clipboard.paste())
+
+ Layout.columnSpan: 2
+ Layout.alignment: Qt.AlignRight
+ }
+
+ Item {
+ Layout.fillHeight: true
+ }
+ }
+ }
+
+ footer: DialogButtonBox {
+ Button {
+ text: qsTr("OK")
+ DialogButtonBox.buttonRole: DialogButtonBox.AcceptRole
+ enabled: !imaginePathTextField.enabled || (imaginePathTextField.enabled && directoryValidator.valid)
+ }
+ Button {
+ text: qsTr("Cancel")
+ DialogButtonBox.buttonRole: DialogButtonBox.RejectRole
+ }
+ }
+}
diff --git a/tests/manual/testbench/assetfixer.cpp b/tests/manual/testbench/assetfixer.cpp
new file mode 100644
index 00000000..21a67573
--- /dev/null
+++ b/tests/manual/testbench/assetfixer.cpp
@@ -0,0 +1,563 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "assetfixer.h"
+
+#include <QDebug>
+#include <QDir>
+#include <QDirIterator>
+#include <QImage>
+#include <QLoggingCategory>
+#include <QQmlApplicationEngine>
+#include <QQuickWindow>
+#include <QtMath>
+
+#include "directoryvalidator.h"
+
+Q_LOGGING_CATEGORY(lcAssetFixer, "qt.quick.controls.tools.testbench.assetfixer.brief")
+Q_LOGGING_CATEGORY(lcAssetFixerVerbose, "qt.quick.controls.tools.testbench.assetfixer.verbose")
+
+static const QColor black = Qt::black;
+static const QColor red = Qt::red;
+
+/*
+ This class:
+
+ - Watches a given asset directory for changes. When it notices a change in the directory's
+ "last modification" time, it suggests that client code call fixAssets(). It suggests
+ rather than just doing it itself because the client code (QML) may want to wait a second
+ or two to see if more changes are coming before doing an expensive fixup, as exporting
+ a bunch of files into a directory will cause several directoryChanged() emissions from
+ QFileSystemWatcher.
+ - Fixes 9-patch image assets via the function below.
+*/
+
+/*
+ This function:
+
+ - Crops the image to the area within the 9-patch lines if necessary.
+ This can happen if e.g. a shadow is applied to an asset in Illustrator
+ and it causes the image to be larger than necessary.
+ - Reduces the thickness of the 9-patch lines. This is necessary to enable
+ designers not to have to worry about creating one pixel-thick lines for
+ each DPI variant of an asset; they can simply export the asset at each
+ DPI variant as usual and this program will fix it for them.
+
+ See README.md for more information.
+*/
+bool cropImageToLines(QImage *image)
+{
+ QRect cropArea;
+ /*
+ We need to keep track of this because of the following case:
+
+ ______________________
+ ______________________
+ ||
+ oooooooooooooooooooooooo
+ ||
+
+ If we didn't keep track of thickness, the top edge's lines would be found fine,
+ but then we'd look at the bottom edge and we'd accidentally pick up the left edge's lines.
+ Keeping track of thickness ensures that we have some way of knowing if we're far enough
+ in for the line to belong to a certain edge.
+
+ Note that this approach is still limited, as it doesn't account for the top edge,
+ but we have to start somewhere in order to find the thickness.
+ */
+ int thickness = 0;
+
+ bool cropTop = false;
+ bool foundOnePixelThick9PatchLine = false;
+ // We have to go row by row because otherwise we might find a pixel that
+ // belongs to e.g. the left edge.
+ for (int y = 0; y < qFloor(image->height() / 2.0) && !cropTop && !foundOnePixelThick9PatchLine; ++y) {
+ for (int x = 1; x < image->width() - 2 && !cropTop && !foundOnePixelThick9PatchLine; ++x) {
+ const QColor pixelColor = image->pixelColor(x, y);
+ if (pixelColor == black || pixelColor == red) {
+ if (y == 0) {
+ const QColor pixelColorBelow = image->pixelColor(x, y + 1);
+ if (pixelColorBelow != black && pixelColorBelow != red) {
+ // We've already found the top of the 9-patch line, and the row below it
+ // is a different color, so we know that it's one pixel thick, and that we're done.
+ // Note that we can't just assume all of the other edges are the same and return here,
+ // as we also need to account for e.g. shadows.
+ qCDebug(lcAssetFixerVerbose) << "found one-pixel-thick nine patch line on top edge at x" << x;
+ foundOnePixelThick9PatchLine = true;
+ thickness = 1;
+ }
+ } else {
+ // It's not already at the top edge, so crop the top edge.
+ cropTop = true;
+
+ // Now that we've found the line, find out how thick it is.
+ for (int yy = y; yy < qFloor(image->height() / 2.0); ++yy) {
+ const QColor pixelColor = image->pixelColor(x, yy);
+ if (pixelColor == black || pixelColor == red) {
+ cropArea.setTop(yy);
+ } else {
+ break;
+ }
+ }
+
+ // + 1 for the pixel that we leave in when cropping,
+ // another +1 for the fact that this else statement is only entered when y > 0
+ if (thickness == 0) {
+ thickness = cropArea.top() - y + 2;
+ qCDebug(lcAssetFixerVerbose) << "found first croppable nine patch line on top edge at x" << x << "y" << y
+ << "with thickness" << thickness;
+ } else {
+ qCDebug(lcAssetFixerVerbose) << "found first croppable nine patch line on top edge at x" << x << "y" << y
+ << "using existing thickness of" << thickness;
+ }
+ }
+ }
+ }
+ }
+
+ bool cropBottom = false;
+ foundOnePixelThick9PatchLine = false;
+ for (int y = image->height() - 1; y >= qCeil(image->height() / 2.0) && !cropBottom && !foundOnePixelThick9PatchLine; --y) {
+ for (int x = qMax(1, thickness); x < image->width() - 2 && !cropBottom && !foundOnePixelThick9PatchLine; ++x) {
+ const QColor pixelColor = image->pixelColor(x, y);
+ if (pixelColor == black || pixelColor == red) {
+ if (y == image->height() - 1) {
+ const QColor pixelColorAbove = image->pixelColor(x, y - 1);
+ if (pixelColorAbove != black && pixelColorAbove != red) {
+ // We've already found the bottom of the 9-patch line, and the row above it
+ // is a different color, so we know that it's one pixel thick, and that we're done.
+ qCDebug(lcAssetFixerVerbose) << "found one-pixel-thick nine patch line on bottom edge at x" << x;
+ foundOnePixelThick9PatchLine = true;
+ if (thickness == 0)
+ thickness = 1;
+ }
+ } else {
+ // It's not already at the bottom edge, so crop the bottom edge.
+ cropBottom = true;
+
+ // Now that we've found the line, find out how thick it is.
+ for (int yy = y; yy >= qCeil(image->height() / 2.0); --yy) {
+ const QColor pixelColor = image->pixelColor(x, yy);
+ if (pixelColor == black || pixelColor == red) {
+ cropArea.setBottom(yy);
+ } else {
+ break;
+ }
+ }
+
+ // + 1 for the pixel that we leave in when cropping,
+ // another +1 for the fact that this else statement is only entered when y < image->height() - 1
+ if (thickness == 0) {
+ thickness = y - cropArea.bottom() + 2;
+ qCDebug(lcAssetFixerVerbose) << "found first croppable nine patch line on bottom edge at x" << x << "y" << y
+ << "with thickness" << thickness;
+ } else {
+ qCDebug(lcAssetFixerVerbose) << "found first croppable nine patch line on bottom edge at x" << x << "y" << y
+ << "using existing thickness of" << thickness;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ bool cropLeft = false;
+ foundOnePixelThick9PatchLine = false;
+ for (int x = 0; x < qFloor(image->width() / 2.0) && !cropLeft && !foundOnePixelThick9PatchLine; ++x) {
+ for (int y = qMax(1, thickness); y < image->height() - 2 && !cropLeft && !foundOnePixelThick9PatchLine; ++y) {
+ const QColor pixelColor = image->pixelColor(x, y);
+ if (pixelColor == black || pixelColor == red) {
+ if (x == 0) {
+ const QColor pixelColorToTheRight = image->pixelColor(x + 1, y);
+ if (pixelColorToTheRight != black && pixelColorToTheRight != red) {
+ // We've already found the beginning of the 9-patch line, and the column after it
+ // is a different color, so we know that it's one pixel thick, and that we're done.
+ qCDebug(lcAssetFixerVerbose) << "found one-pixel-thick nine patch line on left edge at y" << y;
+ foundOnePixelThick9PatchLine = true;
+ }
+ } else {
+ // It's not already at the left edge, so crop the left edge.
+ cropLeft = true;
+
+ // Now that we've found the line, find out how thick it is.
+ for (int xx = x; xx < qFloor(image->width() / 2.0); ++xx) {
+ const QColor pixelColor = image->pixelColor(xx, y);
+ if (pixelColor == black || pixelColor == red) {
+ cropArea.setLeft(xx);
+ } else {
+ break;
+ }
+ }
+
+ // + 1 for the pixel that we leave in when cropping,
+ // another +1 for the fact that this else statement is only entered when x > 0
+ if (thickness == 0) {
+ thickness = cropArea.left() - x + 2;
+ qCDebug(lcAssetFixerVerbose) << "found first croppable nine patch line on left edge at x" << x << "y" << y
+ << "with thickness" << thickness;
+ } else {
+ qCDebug(lcAssetFixerVerbose) << "found first croppable nine patch line on left edge at x" << x << "y" << y
+ << "using existing thickness of" << thickness;
+ }
+ }
+ }
+ }
+ }
+
+ bool cropRight = false;
+ foundOnePixelThick9PatchLine = false;
+ for (int x = image->width() - 1; x >= qCeil(image->width() / 2.0) && !cropRight && !foundOnePixelThick9PatchLine; --x) {
+ for (int y = qMax(1, thickness); y < image->height() - 2 && !cropRight && !foundOnePixelThick9PatchLine; ++y) {
+ const QColor pixelColor = image->pixelColor(x, y);
+ if (pixelColor == black || pixelColor == red) {
+ if (x == image->width() - 1) {
+ const QColor pixelColorToTheLeft = image->pixelColor(x - 1, y);
+ if (pixelColorToTheLeft != black && pixelColorToTheLeft != red) {
+ // We've already found the end of the 9-patch line, and the column before it
+ // is a different color, so we know that it's one pixel thick, and that we're done.
+ qCDebug(lcAssetFixerVerbose) << "found one-pixel-thick nine patch line on right edge at y" << y;
+ foundOnePixelThick9PatchLine = true;
+ }
+ } else {
+ // It's not already at the right edge, so crop the right edge.
+ cropRight = true;
+
+ // Now that we've found the line, find out how thick it is.
+ for (int xx = x; xx >= qCeil(image->width() / 2.0); --xx) {
+ const QColor pixelColor = image->pixelColor(xx, y);
+ if (pixelColor == black || pixelColor == red) {
+ cropArea.setRight(xx);
+ } else {
+ break;
+ }
+ }
+
+ // + 1 for the pixel that we leave in when cropping,
+ // another +1 for the fact that this else statement is only entered when x < image->width() - 1
+ if (thickness == 0) {
+ thickness = x - cropArea.right() + 2;
+ qCDebug(lcAssetFixerVerbose) << "found first croppable nine patch line on right edge at x" << x << "y" << y
+ << "with thickness" << thickness;
+ } else {
+ qCDebug(lcAssetFixerVerbose) << "found first croppable nine patch line on right edge at x" << x << "y" << y
+ << "using existing thickness of" << thickness;
+ }
+ }
+ break;
+ }
+ }
+ }
+
+ const QRect copyArea(cropLeft ? cropArea.x() : (thickness ? thickness - 1 : 0),
+ cropTop ? cropArea.y() : (thickness ? thickness - 1 : 0),
+ cropRight ? cropArea.width() : image->width() - (thickness ? (thickness - 1) * 2 : 0),
+ cropBottom ? cropArea.height() : image->height() - (thickness ? (thickness - 1) * 2 : 0));
+
+ if (cropLeft | cropRight | cropTop | cropBottom) {
+ qCDebug(lcAssetFixerVerbose) << "cropping area" << copyArea;
+ *image = image->copy(copyArea);
+ return true;
+ }
+
+ return false;
+}
+
+AssetFixer::AssetFixer(QObject *parent) :
+ QObject(parent),
+ mComponentComplete(false),
+ mFirstWatch(true),
+ mShouldWatch(false),
+ mShouldFix(false),
+ mLastModified(QDateTime::fromSecsSinceEpoch(0))
+{
+}
+
+bool AssetFixer::shouldWatch() const
+{
+ return mShouldWatch;
+}
+
+void AssetFixer::setShouldWatch(bool watch)
+{
+ if (watch == mShouldWatch)
+ return;
+
+ stopWatching();
+
+ mShouldWatch = watch;
+
+ startWatching();
+
+ emit shouldWatchChanged();
+}
+
+bool AssetFixer::shouldFix() const
+{
+ return mShouldFix;
+}
+
+void AssetFixer::setShouldFix(bool fix)
+{
+ if (fix == mShouldFix)
+ return;
+
+ mShouldFix = fix;
+ emit shouldFixChanged();
+}
+
+QString AssetFixer::assetDirectory() const
+{
+ return mAssetDirectory;
+}
+
+void AssetFixer::setAssetDirectory(const QString &assetDirectory)
+{
+ if (assetDirectory == mAssetDirectory)
+ return;
+
+ stopWatching();
+
+ const QString oldAssetDirectory = assetDirectory;
+ mAssetDirectory.clear();
+
+ if (isAssetDirectoryValid(assetDirectory)) {
+ mAssetDirectory = assetDirectory;
+ startWatching();
+ }
+
+ if (mAssetDirectory != oldAssetDirectory)
+ emit assetDirectoryChanged();
+}
+
+QUrl AssetFixer::assetDirectoryUrl() const
+{
+ return QUrl::fromLocalFile(mAssetDirectory);
+}
+
+QDateTime AssetFixer::assetDirectoryLastModified() const
+{
+ return mLastModified;
+}
+
+void AssetFixer::setAssetDirectoryLastModified(const QDateTime &assetDirectoryLastModified)
+{
+ if (assetDirectoryLastModified == mLastModified)
+ return;
+
+ mLastModified = assetDirectoryLastModified;
+ emit assetDirectoryLastModifiedChanged();
+}
+
+void AssetFixer::componentComplete()
+{
+ mComponentComplete = true;
+}
+
+void AssetFixer::classBegin()
+{
+}
+
+void AssetFixer::onAssetsChanged()
+{
+ const QFileInfo fileInfo(mAssetDirectory);
+ const QDateTime lastModified = fileInfo.lastModified();
+
+ qCDebug(lcAssetFixer) << "Change in asset directory" << mAssetDirectory << "detected"
+ << "lastModified:" << lastModified;
+ const qint64 secsSinceLastModification = mLastModified.secsTo(lastModified);
+ if (secsSinceLastModification == 0) {
+ qCDebug(lcAssetFixer) << "Change in asset directory" << mAssetDirectory << "detected, "
+ << "but QFileInfo says the directory hasn't been modified; ignoring";
+ } else {
+ setAssetDirectoryLastModified(lastModified);
+
+ QString message;
+ if (lcAssetFixer().isDebugEnabled()) {
+ message = QString::fromLatin1("Change in asset directory %1 detected, and QFileInfo says that there have been " \
+ "%2 seconds since it was previously last modified); %3").arg(mAssetDirectory).arg(secsSinceLastModification);
+ }
+
+ if (shouldFix()) {
+ qCDebug(lcAssetFixer) << message.arg(QLatin1String("suggesting delayed fix"));
+ emit delayedFixSuggested();
+ } else {
+ qCDebug(lcAssetFixer) << message.arg(QLatin1String("suggesting reload"));
+ emit reloadSuggested();
+ }
+ }
+}
+
+void AssetFixer::stopWatching()
+{
+ if (!mShouldWatch || mAssetDirectory.isEmpty() || !mComponentComplete)
+ return;
+
+ disconnect(&mFileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, &AssetFixer::onAssetsChanged);
+ mFileSystemWatcher.removePath(mAssetDirectory);
+}
+
+void AssetFixer::startWatching()
+{
+ if (!mShouldWatch || mAssetDirectory.isEmpty() || !mComponentComplete || !isAssetDirectoryValid(mAssetDirectory))
+ return;
+
+ if (mFileSystemWatcher.addPath(mAssetDirectory)) {
+ // TODO: for some reason this is not called when an image is edited, but is when the same image is "touch"ed.
+ // We could add watchers for each file, but then the application might have to be limited to displaying
+ // the elements for one control at a time so that we don't breach the 256 file descriptor limit on some platforms:
+ // http://doc.qt.io/qt-5/qfilesystemwatcher.html#details
+
+ // We only emit a signal here rather than automatically responding to it ourselves,
+ // because we want to give the UI time to start animations.
+ connect(&mFileSystemWatcher, &QFileSystemWatcher::directoryChanged, this, &AssetFixer::onAssetsChanged);
+
+ const QFileInfo fileInfo(mAssetDirectory);
+ bool suggestFix = false;
+ if (mFirstWatch) {
+ mFirstWatch = false;
+
+ // Here we check if the assets have been modified since the last time the application closed.
+ // Checking this avoids a slow startup (due to fixing up assets).
+ if (fileInfo.lastModified() > mLastModified) {
+ qCDebug(lcAssetFixer) << "asset directory" << mAssetDirectory << "was modified at"
+ << fileInfo.lastModified() << ", which is later than our last stored modification time of"
+ << mLastModified << "; suggesting fix";
+ suggestFix = true;
+ } else {
+ qCDebug(lcAssetFixer) << "asset directory" << mAssetDirectory << "has not been modified since"
+ << "the application was last closed; a fix is not necessary";
+
+ // For some reason not all assets are updated if we don't do this.
+ emit reloadSuggested();
+ }
+
+ // Don't need to call setAssetDirectoryLastModified() here, as we should have gotten it from settings.
+ } else {
+ suggestFix = true;
+ }
+
+ if (suggestFix) {
+ setAssetDirectoryLastModified(fileInfo.lastModified());
+ emit fixSuggested();
+ }
+ } else {
+ qWarning() << "Could not watch asset directory" << mAssetDirectory;
+ }
+}
+
+bool AssetFixer::isAssetDirectoryValid(const QString &assetDirectory)
+{
+ DirectoryValidator validator;
+ validator.setPath(assetDirectory);
+ return validator.isValid();
+}
+
+void AssetFixer::clearImageCache()
+{
+ QQmlApplicationEngine *engine = qobject_cast<QQmlApplicationEngine*>(qmlEngine(this));
+ if (!engine) {
+ qWarning() << "No QQmlApplicationEngine for AssetFixer - assets may not reload properly";
+ return;
+ }
+
+ QQuickWindow *window = qobject_cast<QQuickWindow*>(engine->rootObjects().first());
+ if (!window) {
+ qWarning() << "No QQuickWindow - assets may not reload properly";
+ return;
+ }
+
+ // We can't seem to disable image caching on a per-Image basis (by the time the QQuickImages
+ // are available, the cache has already been filled), so we call this instead.
+ window->releaseResources();
+}
+
+void AssetFixer::fixAssets()
+{
+ if (!mShouldWatch || !mShouldFix || !mComponentComplete || mAssetDirectory.isEmpty() || !isAssetDirectoryValid(mAssetDirectory))
+ return;
+
+ QDir assetDir(mAssetDirectory);
+ qCDebug(lcAssetFixer) << "Fixing up assets in" << assetDir.absolutePath() << "...";
+ int filesChanged = 0;
+
+ QStringList nameFilters;
+ nameFilters << QLatin1String("*.9.png");
+ QDirIterator dirIt(assetDir.absolutePath(), nameFilters, QDir::Files | QDir::Readable | QDir::NoSymLinks);
+ while (dirIt.hasNext()) {
+ const QString imagePath = dirIt.next();
+
+ QImage image(imagePath);
+ if (image.isNull()) {
+ qWarning() << "Couldn't open image at" << imagePath;
+ return;
+ }
+
+ qCDebug(lcAssetFixerVerbose).nospace() << "found " << imagePath << " (" << image.width() << "x" << image.height() << ") - "
+ << "checking if we need to crop 9-patch lines";
+
+ if (cropImageToLines(&image)) {
+ if (!image.save(imagePath)) {
+ qWarning() << "Couldn't save" << imagePath;
+ return;
+ }
+
+ ++filesChanged;
+ }
+ }
+
+ qCDebug(lcAssetFixer) << "Fixed" << filesChanged << "assets";
+
+ // Let the application know that it should reload the Imagine style's assets.
+ // Currently we always suggest a reload after fixing files, even if no files were fixed.
+ // This is because the default Imagine style assets are automatically loaded at first, and then we
+ // set a custom path shortly after, so we must ensure that the Imagine style is using the correct assets.
+ // Reloads are just a matter of changing Imagine.path, which is very fast.
+ emit reloadSuggested();
+}
diff --git a/tests/manual/testbench/assetfixer.h b/tests/manual/testbench/assetfixer.h
new file mode 100644
index 00000000..4af9ccf4
--- /dev/null
+++ b/tests/manual/testbench/assetfixer.h
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef ASSETFIXER_H
+#define ASSETFIXER_H
+
+#include <QObject>
+#include <QDateTime>
+#include <QFileSystemWatcher>
+#include <QQmlParserStatus>
+#include <QUrl>
+
+class AssetFixer : public QObject, public QQmlParserStatus
+{
+ Q_OBJECT
+ Q_PROPERTY(bool shouldWatch READ shouldWatch WRITE setShouldWatch NOTIFY shouldWatchChanged FINAL)
+ Q_PROPERTY(bool shouldFix READ shouldFix WRITE setShouldFix NOTIFY shouldFixChanged FINAL)
+ Q_PROPERTY(QString assetDirectory READ assetDirectory WRITE setAssetDirectory NOTIFY assetDirectoryChanged FINAL)
+ Q_PROPERTY(QUrl assetDirectoryUrl READ assetDirectoryUrl NOTIFY assetDirectoryChanged FINAL)
+ Q_PROPERTY(QDateTime assetDirectoryLastModified READ assetDirectoryLastModified WRITE setAssetDirectoryLastModified
+ NOTIFY assetDirectoryLastModifiedChanged FINAL)
+ Q_INTERFACES(QQmlParserStatus)
+
+public:
+ explicit AssetFixer(QObject *parent = nullptr);
+
+ bool shouldWatch() const;
+ void setShouldWatch(bool shouldWatch);
+
+ bool shouldFix() const;
+ void setShouldFix(bool shouldFix);
+
+ QString assetDirectory() const;
+ void setAssetDirectory(const QString &assetDirectory);
+
+ QUrl assetDirectoryUrl() const;
+
+ QDateTime assetDirectoryLastModified() const;
+ void setAssetDirectoryLastModified(const QDateTime &assetDirectoryLastModified);
+
+signals:
+ void shouldWatchChanged();
+ void shouldFixChanged();
+ void assetDirectoryChanged();
+ void assetDirectoryLastModifiedChanged();
+
+ void fixSuggested();
+ void delayedFixSuggested();
+ void reloadSuggested();
+
+ void error(const QString &errorMessage);
+
+public slots:
+ void clearImageCache();
+ void fixAssets();
+
+protected:
+ void componentComplete() override;
+ void classBegin() override;
+
+private slots:
+ void onAssetsChanged();
+
+private:
+ void stopWatching();
+ void startWatching();
+
+ bool isAssetDirectoryValid(const QString &assetDirectory);
+
+ bool mComponentComplete;
+ bool mFirstWatch;
+ bool mShouldWatch;
+ bool mShouldFix;
+ QString mAssetDirectory;
+ QFileSystemWatcher mFileSystemWatcher;
+ QDateTime mLastModified;
+};
+
+#endif // ASSETFIXER_H
diff --git a/tests/manual/testbench/clipboard.cpp b/tests/manual/testbench/clipboard.cpp
new file mode 100644
index 00000000..1daebfc9
--- /dev/null
+++ b/tests/manual/testbench/clipboard.cpp
@@ -0,0 +1,124 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "clipboard.h"
+
+#include <QClipboard>
+#include <QGuiApplication>
+#include <QSettings>
+
+const QStringList keys = {
+ "Palette/window",
+ "Palette/windowText",
+ "Palette/base",
+ "Palette/text",
+ "Palette/button",
+ "Palette/buttonText",
+ "Palette/brightText",
+ "Palette/toolTipBase",
+ "Palette/toolTipText",
+ "Palette/light",
+ "Palette/midlight",
+ "Palette/dark",
+ "Palette/mid",
+ "Palette/shadow",
+ "Palette/highlight",
+ "Palette/highlightedText",
+ "Palette/link"
+};
+
+Clipboard::Clipboard(QObject *parent) :
+ QObject(parent)
+{
+}
+
+// Converts the JS map into a big string and copies it to the clipboard.
+void Clipboard::copy(const QJSValue &keyValueMap)
+{
+ QString paletteSettingsString;
+ QVariantMap map = keyValueMap.toVariant().value<QVariantMap>();
+ const QList<QString> mapKeys = map.keys();
+ for (const QString &key : mapKeys) {
+ paletteSettingsString += "Palette/" + key + "=" + map.value(key).toString() + ",";
+ }
+
+ // Remove the trailing comma.
+ if (!paletteSettingsString.isEmpty())
+ paletteSettingsString.chop(1);
+
+ QGuiApplication::clipboard()->setText(paletteSettingsString);
+}
+
+// Converts the big string into a JS map and returns it.
+QVariant Clipboard::paste() const
+{
+ QClipboard *clipboard = QGuiApplication::clipboard();
+ if (clipboard->text().isEmpty())
+ return QVariant();
+
+ QVariantMap keyValueMap;
+
+ const QStringList settingsList = clipboard->text().split(QLatin1Char(','));
+ for (const QString &setting : settingsList) {
+ const QStringList keyValuePair = setting.split(QLatin1Char('='));
+ if (keyValuePair.size() < 2)
+ continue;
+
+ QString key = keyValuePair.first();
+ if (keys.contains(key)) {
+ key.remove(QLatin1String("Palette/"));
+ const QString value = keyValuePair.last();
+
+ keyValueMap.insert(key, value);
+ }
+ }
+
+ return QVariant(keyValueMap);
+}
diff --git a/tests/manual/testbench/clipboard.h b/tests/manual/testbench/clipboard.h
new file mode 100644
index 00000000..a21dd9c6
--- /dev/null
+++ b/tests/manual/testbench/clipboard.h
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef CLIPBOARD_H
+#define CLIPBOARD_H
+
+#include <QObject>
+#include <QJSValue>
+#include <QVariant>
+
+class Clipboard : public QObject
+{
+ Q_OBJECT
+public:
+ explicit Clipboard(QObject *parent = nullptr);
+
+public slots:
+ void copy(const QJSValue &keyValueMap);
+ QVariant paste() const;
+
+// void copyPaletteSettingsToClipboard();
+// void importPaletteSettingsFromClipboard();
+};
+
+#endif // CLIPBOARD_H
diff --git a/tests/manual/testbench/controls/BusyIndicator.qml b/tests/manual/testbench/controls/BusyIndicator.qml
new file mode 100644
index 00000000..97456a93
--- /dev/null
+++ b/tests/manual/testbench/controls/BusyIndicator.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+QtObject {
+ property var supportedStates: [
+ [],
+ ["disabled"],
+ ["mirrored"]
+ ]
+
+ property Component component: BusyIndicator {
+ enabled: !is("disabled")
+ LayoutMirroring.enabled: is("mirrored")
+ }
+}
diff --git a/tests/manual/testbench/controls/Button.qml b/tests/manual/testbench/controls/Button.qml
new file mode 100644
index 00000000..6d65b3ee
--- /dev/null
+++ b/tests/manual/testbench/controls/Button.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+QtObject {
+ property var supportedStates: [
+ [],
+ ["disabled"],
+ ["pressed"],
+ ["checked"],
+ ["checked", "disabled"],
+ ["checked", "hovered"],
+ ["highlighted"],
+ ["highlighted", "disabled"],
+ ["highlighted", "hovered"],
+ ["highlighted", "pressed"],
+ ["highlighted", "checked"],
+ ["highlighted", "checkable", "hovered"],
+ ["highlighted", "checkable", "pressed"],
+ ["highlighted", "checkable", "checked"],
+ ["hovered"],
+ ["flat"],
+ ["flat", "disabled"],
+ ["flat", "hovered"],
+ ["flat", "pressed"],
+ ["flat", "checked"],
+ ["flat", "checkable"],
+ ["flat", "checkable", "hovered"],
+ ["flat", "checkable", "pressed"],
+ ["flat", "checkable", "checked", "pressed"],
+ ["flat", "checkable", "highlighted"],
+ ["flat", "checkable", "highlighted", "pressed"],
+ ["flat", "checkable", "highlighted", "checked"]
+ ]
+
+ property Component component: Button {
+ text: "Button"
+ 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/testbench/controls/CheckBox.qml b/tests/manual/testbench/controls/CheckBox.qml
new file mode 100644
index 00000000..73f94857
--- /dev/null
+++ b/tests/manual/testbench/controls/CheckBox.qml
@@ -0,0 +1,74 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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/testbench/controls/CheckDelegate.qml b/tests/manual/testbench/controls/CheckDelegate.qml
new file mode 100644
index 00000000..fc6ce6eb
--- /dev/null
+++ b/tests/manual/testbench/controls/CheckDelegate.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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
+ }
+
+ property Component exampleComponent: ListView {
+ implicitWidth: 200
+ implicitHeight: 200
+ clip: true
+ model: 20
+ delegate: CheckDelegate {
+ width: parent.width
+ text: "CheckDelegate"
+ }
+ }
+}
diff --git a/tests/manual/testbench/controls/ComboBox.qml b/tests/manual/testbench/controls/ComboBox.qml
new file mode 100644
index 00000000..c9b8498f
--- /dev/null
+++ b/tests/manual/testbench/controls/ComboBox.qml
@@ -0,0 +1,71 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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/testbench/controls/DelayButton.qml b/tests/manual/testbench/controls/DelayButton.qml
new file mode 100644
index 00000000..af52e067
--- /dev/null
+++ b/tests/manual/testbench/controls/DelayButton.qml
@@ -0,0 +1,72 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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
+ onDownChanged: print("down", down)
+ }
+ }
+}
diff --git a/tests/manual/testbench/controls/Dial.qml b/tests/manual/testbench/controls/Dial.qml
new file mode 100644
index 00000000..5dc8c356
--- /dev/null
+++ b/tests/manual/testbench/controls/Dial.qml
@@ -0,0 +1,65 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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/testbench/controls/Dialog.qml b/tests/manual/testbench/controls/Dialog.qml
new file mode 100644
index 00000000..b05ef1e3
--- /dev/null
+++ b/tests/manual/testbench/controls/Dialog.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.3
+
+// TODO
+QtObject {
+ property string customControlName: qsTr("Dialog")
+
+ property var supportedStates: [
+ []
+ ]
+
+ 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
+
+ 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/testbench/controls/Frame.qml b/tests/manual/testbench/controls/Frame.qml
new file mode 100644
index 00000000..c0348025
--- /dev/null
+++ b/tests/manual/testbench/controls/Frame.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+QtObject {
+ property var supportedStates: [
+ [],
+ ]
+
+ property Component component: Frame {
+ Label {
+ text: "Frame"
+ }
+ }
+}
diff --git a/tests/manual/testbench/controls/GroupBox.qml b/tests/manual/testbench/controls/GroupBox.qml
new file mode 100644
index 00000000..a99a998a
--- /dev/null
+++ b/tests/manual/testbench/controls/GroupBox.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+QtObject {
+ property var supportedStates: [
+ [],
+ ]
+
+ property Component component: GroupBox {
+ title: qsTr("Title")
+
+ Label {
+ text: qsTr("GroupBox")
+ }
+ }
+}
diff --git a/tests/manual/testbench/controls/ItemDelegate.qml b/tests/manual/testbench/controls/ItemDelegate.qml
new file mode 100644
index 00000000..98f13556
--- /dev/null
+++ b/tests/manual/testbench/controls/ItemDelegate.qml
@@ -0,0 +1,82 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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")
+ }
+
+ property Component exampleComponent: ListView {
+ implicitWidth: 200
+ implicitHeight: 200
+ clip: true
+ model: 20
+ delegate: ItemDelegate {
+ width: parent.width
+ text: "ItemDelegate"
+ }
+ }
+}
diff --git a/tests/manual/testbench/controls/Label.qml b/tests/manual/testbench/controls/Label.qml
new file mode 100644
index 00000000..c0d980e8
--- /dev/null
+++ b/tests/manual/testbench/controls/Label.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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/testbench/controls/Menu.qml b/tests/manual/testbench/controls/Menu.qml
new file mode 100644
index 00000000..c449dd47
--- /dev/null
+++ b/tests/manual/testbench/controls/Menu.qml
@@ -0,0 +1,121 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.3
+
+// 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: "Disabled Submenu"
+ enabled: false
+ }
+ }
+ }
+}
diff --git a/tests/manual/testbench/controls/Page.qml b/tests/manual/testbench/controls/Page.qml
new file mode 100644
index 00000000..117359f9
--- /dev/null
+++ b/tests/manual/testbench/controls/Page.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+QtObject {
+ property var supportedStates: [
+ [],
+ ]
+
+ property Component component: Page {
+ width: 100
+ height: 100
+
+ Label {
+ text: "Page"
+ anchors.centerIn: parent
+ }
+ }
+}
diff --git a/tests/manual/testbench/controls/PageIndicator.qml b/tests/manual/testbench/controls/PageIndicator.qml
new file mode 100644
index 00000000..e8d3f570
--- /dev/null
+++ b/tests/manual/testbench/controls/PageIndicator.qml
@@ -0,0 +1,111 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.3
+
+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/testbench/controls/Pane.qml b/tests/manual/testbench/controls/Pane.qml
new file mode 100644
index 00000000..d39adff4
--- /dev/null
+++ b/tests/manual/testbench/controls/Pane.qml
@@ -0,0 +1,68 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+QtObject {
+ property var supportedStates: [
+ [],
+ ]
+
+ property Component component: Pane {
+ width: 100
+ height: 100
+
+ Label {
+ text: "Pane"
+ anchors.centerIn: parent
+ }
+ }
+}
diff --git a/tests/manual/testbench/controls/ProgressBar.qml b/tests/manual/testbench/controls/ProgressBar.qml
new file mode 100644
index 00000000..1fdb02b2
--- /dev/null
+++ b/tests/manual/testbench/controls/ProgressBar.qml
@@ -0,0 +1,66 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+QtObject {
+ property var supportedStates: [
+ [],
+ ["disabled"],
+ ["indeterminate"]
+ ]
+
+ property Component component: ProgressBar {
+ enabled: !is("disabled")
+ indeterminate: is("indeterminate")
+ value: 0.25
+ }
+}
diff --git a/tests/manual/testbench/controls/RadioButton.qml b/tests/manual/testbench/controls/RadioButton.qml
new file mode 100644
index 00000000..b1a10e0f
--- /dev/null
+++ b/tests/manual/testbench/controls/RadioButton.qml
@@ -0,0 +1,73 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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/testbench/controls/RadioDelegate.qml b/tests/manual/testbench/controls/RadioDelegate.qml
new file mode 100644
index 00000000..cb1f6139
--- /dev/null
+++ b/tests/manual/testbench/controls/RadioDelegate.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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
+ }
+ }
+
+ property Component exampleComponent: ListView {
+ implicitWidth: 200
+ implicitHeight: 200
+ clip: true
+ model: 20
+ delegate: RadioDelegate {
+ width: parent.width
+ text: "RadioDelegate"
+ }
+ }
+}
diff --git a/tests/manual/testbench/controls/RangeSlider.qml b/tests/manual/testbench/controls/RangeSlider.qml
new file mode 100644
index 00000000..debd097c
--- /dev/null
+++ b/tests/manual/testbench/controls/RangeSlider.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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/testbench/controls/RoundButton.qml b/tests/manual/testbench/controls/RoundButton.qml
new file mode 100644
index 00000000..75eedf38
--- /dev/null
+++ b/tests/manual/testbench/controls/RoundButton.qml
@@ -0,0 +1,94 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+QtObject {
+ property var supportedStates: [
+ [],
+ ["disabled"],
+ ["pressed"],
+ ["checked"],
+ ["checked", "disabled"],
+ ["checked", "hovered"],
+ ["highlighted"],
+ ["highlighted", "disabled"],
+ ["highlighted", "hovered"],
+ ["highlighted", "pressed"],
+ ["highlighted", "checked"],
+ ["highlighted", "checkable", "hovered"],
+ ["highlighted", "checkable", "pressed"],
+ ["highlighted", "checkable", "checked"],
+ ["hovered"],
+ ["flat"],
+ ["flat", "disabled"],
+ ["flat", "hovered"],
+ ["flat", "pressed"],
+ ["flat", "checked"],
+ ["flat", "checkable"],
+ ["flat", "checkable", "hovered"],
+ ["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/testbench/controls/ScrollBar.qml b/tests/manual/testbench/controls/ScrollBar.qml
new file mode 100644
index 00000000..abe1d007
--- /dev/null
+++ b/tests/manual/testbench/controls/ScrollBar.qml
@@ -0,0 +1,114 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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.Vertical
+ 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/testbench/controls/ScrollIndicator.qml b/tests/manual/testbench/controls/ScrollIndicator.qml
new file mode 100644
index 00000000..8c5079fa
--- /dev/null
+++ b/tests/manual/testbench/controls/ScrollIndicator.qml
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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.Vertical
+ 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/testbench/controls/Slider.qml b/tests/manual/testbench/controls/Slider.qml
new file mode 100644
index 00000000..d2a272fa
--- /dev/null
+++ b/tests/manual/testbench/controls/Slider.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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/testbench/controls/SpinBox.qml b/tests/manual/testbench/controls/SpinBox.qml
new file mode 100644
index 00000000..87e5cfae
--- /dev/null
+++ b/tests/manual/testbench/controls/SpinBox.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+QtObject {
+ property var supportedStates: [
+ ["disabled"],
+ ["pressed"],
+ ["mirrored"],
+ ["mirrored", "disabled"],
+ ["mirrored", "pressed"],
+ ["editable"],
+ ["editable", "pressed"],
+ ["editable", "mirrored"],
+ ["editable", "mirrored", "pressed"],
+ ["editable", "mirrored", "mirrored"]
+ ]
+
+ 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/testbench/controls/SwipeDelegate.qml b/tests/manual/testbench/controls/SwipeDelegate.qml
new file mode 100644
index 00000000..3ea67101
--- /dev/null
+++ b/tests/manual/testbench/controls/SwipeDelegate.qml
@@ -0,0 +1,104 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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")
+
+ 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"
+
+ swipe.left: actionComponent
+ swipe.right: actionComponent
+ }
+ }
+}
diff --git a/tests/manual/testbench/controls/Switch.qml b/tests/manual/testbench/controls/Switch.qml
new file mode 100644
index 00000000..70f44abd
--- /dev/null
+++ b/tests/manual/testbench/controls/Switch.qml
@@ -0,0 +1,76 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+QtObject {
+ property var supportedStates: [
+ [],
+ ["disabled"],
+ ["pressed"],
+ ["checked"],
+ ["checked", "disabled"],
+ ["checked", "disabled", "mirrored"],
+ ["checked", "pressed"],
+ ["checked", "pressed", "mirrored"],
+ ["mirrored"],
+ ]
+
+ property Component component: Switch {
+ text: "CheckBox"
+ 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/testbench/controls/SwitchDelegate.qml b/tests/manual/testbench/controls/SwitchDelegate.qml
new file mode 100644
index 00000000..aad2eed3
--- /dev/null
+++ b/tests/manual/testbench/controls/SwitchDelegate.qml
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+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")
+
+ LayoutMirroring.enabled: is("mirrored")
+ }
+
+ property Component exampleComponent: ListView {
+ implicitWidth: 200
+ implicitHeight: 200
+ clip: true
+ model: 20
+ delegate: SwitchDelegate {
+ width: parent.width
+ text: "SwitchDelegate"
+ }
+ }
+}
diff --git a/tests/manual/testbench/controls/TabBar.qml b/tests/manual/testbench/controls/TabBar.qml
new file mode 100644
index 00000000..4e6440d3
--- /dev/null
+++ b/tests/manual/testbench/controls/TabBar.qml
@@ -0,0 +1,81 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+// 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/testbench/controls/TextArea.qml b/tests/manual/testbench/controls/TextArea.qml
new file mode 100644
index 00000000..de34076a
--- /dev/null
+++ b/tests/manual/testbench/controls/TextArea.qml
@@ -0,0 +1,63 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+QtObject {
+ property var supportedStates: [
+ [],
+ ["disabled"],
+ ]
+
+ property Component component: TextArea {
+ text: "TextArea\nTextArea\nTextArea"
+ }
+}
diff --git a/tests/manual/testbench/controls/TextField.qml b/tests/manual/testbench/controls/TextField.qml
new file mode 100644
index 00000000..6986854b
--- /dev/null
+++ b/tests/manual/testbench/controls/TextField.qml
@@ -0,0 +1,64 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+
+QtObject {
+ property var supportedStates: [
+ [],
+ ["disabled"],
+ ]
+
+ property Component component: TextField {
+ text: "TextField"
+ enabled: !is("disabled")
+ }
+}
diff --git a/tests/manual/testbench/controls/ToolBar.qml b/tests/manual/testbench/controls/ToolBar.qml
new file mode 100644
index 00000000..7ce40218
--- /dev/null
+++ b/tests/manual/testbench/controls/ToolBar.qml
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.3
+
+// 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/testbench/controls/ToolTip.qml b/tests/manual/testbench/controls/ToolTip.qml
new file mode 100644
index 00000000..19ae9dd1
--- /dev/null
+++ b/tests/manual/testbench/controls/ToolTip.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.3
+
+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/testbench/controls/Tumbler.qml b/tests/manual/testbench/controls/Tumbler.qml
new file mode 100644
index 00000000..0d64ff3b
--- /dev/null
+++ b/tests/manual/testbench/controls/Tumbler.qml
@@ -0,0 +1,67 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.10
+import QtQuick.Controls 2.3
+import QtQuick.Layouts 1.3
+
+QtObject {
+ property var supportedStates: [
+ [],
+ ["disabled"]
+ ]
+
+ property Component component: Tumbler {
+ model: 20
+ enabled: !is("disabled")
+
+ LayoutMirroring.enabled: is("mirrored")
+ }
+}
diff --git a/tests/manual/testbench/directoryvalidator.cpp b/tests/manual/testbench/directoryvalidator.cpp
new file mode 100644
index 00000000..d0d4cd8d
--- /dev/null
+++ b/tests/manual/testbench/directoryvalidator.cpp
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include "directoryvalidator.h"
+
+#include <QFileInfo>
+
+DirectoryValidator::DirectoryValidator(QObject *parent) :
+ QObject(parent)
+{
+}
+
+QString DirectoryValidator::path() const
+{
+ return mPath;
+}
+
+void DirectoryValidator::setPath(const QString &path)
+{
+ if (path == mPath)
+ return;
+
+ const bool wasValid = isValid();
+ const QString oldErrorMessage = mErrorMessage;
+
+ mPath = path;
+ mErrorMessage.clear();
+
+ QFileInfo fileInfo(mPath);
+ if (!fileInfo.exists()) {
+ mErrorMessage = QLatin1String("Directory does not exist");
+ } else {
+ if (!fileInfo.isDir()) {
+ mErrorMessage = QLatin1String("Not a directory");
+ }
+ }
+
+ if (isValid() != wasValid)
+ emit validChanged();
+
+ if (mErrorMessage != oldErrorMessage)
+ emit errorMessageChanged();
+
+ emit pathChanged();
+}
+
+bool DirectoryValidator::isValid() const
+{
+ return mErrorMessage.isEmpty();
+}
+
+QString DirectoryValidator::errorMessage() const
+{
+ return mErrorMessage;
+}
diff --git a/tests/manual/testbench/directoryvalidator.h b/tests/manual/testbench/directoryvalidator.h
new file mode 100644
index 00000000..a1650d86
--- /dev/null
+++ b/tests/manual/testbench/directoryvalidator.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2017 The Qt Company Ltd.
+** Contact: https://www.qt.io/licensing/
+**
+** This file is part of the test suite of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:BSD$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** BSD License Usage
+** Alternatively, you may use this file under the terms of the BSD license
+** as follows:
+**
+** "Redistribution and use in source and binary forms, with or without
+** modification, are permitted provided that the following conditions are
+** met:
+** * Redistributions of source code must retain the above copyright
+** notice, this list of conditions and the following disclaimer.
+** * Redistributions in binary form must reproduce the above copyright
+** notice, this list of conditions and the following disclaimer in
+** the documentation and/or other materials provided with the
+** distribution.
+** * Neither the name of The Qt Company Ltd nor the names of its
+** contributors may be used to endorse or promote products derived
+** from this software without specific prior written permission.
+**
+**
+** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef DIRECTORYVALIDATOR_H
+#define DIRECTORYVALIDATOR_H
+
+#include <QObject>
+
+class DirectoryValidator : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QString path READ path WRITE setPath NOTIFY pathChanged FINAL)
+ Q_PROPERTY(bool valid READ isValid NOTIFY validChanged FINAL)
+ Q_PROPERTY(QString errorMessage READ errorMessage NOTIFY errorMessageChanged FINAL)
+
+public:
+ explicit DirectoryValidator(QObject *parent = nullptr);
+
+ QString path() const;
+ void setPath(const QString &path);
+
+ bool isValid() const;
+ QString errorMessage() const;
+
+signals:
+ void pathChanged();
+ void validChanged();
+ void errorMessageChanged();
+
+private:
+ void updateValid();
+
+ QString mPath;
+ QString mErrorMessage;
+};
+
+#endif // DIRECTORYVALIDATOR_H
diff --git a/tests/manual/testbench/fonts.qrc b/tests/manual/testbench/fonts.qrc
new file mode 100644
index 00000000..fc86e031
--- /dev/null
+++ b/tests/manual/testbench/fonts.qrc
@@ -0,0 +1,5 @@
+<RCC>
+ <qresource prefix="/">
+ <file>fonts/fontawesome.ttf</file>
+ </qresource>
+</RCC>
diff --git a/tests/manual/testbench/fonts/LICENSE.txt b/tests/manual/testbench/fonts/LICENSE.txt
new file mode 100755
index 00000000..8fa3da36
--- /dev/null
+++ b/tests/manual/testbench/fonts/LICENSE.txt
@@ -0,0 +1,12 @@
+Font license info
+
+
+## Font Awesome
+
+ Copyright (C) 2016 by Dave Gandy
+
+ Author: Dave Gandy
+ License: SIL ()
+ Homepage: http://fortawesome.github.com/Font-Awesome/
+
+
diff --git a/tests/manual/testbench/fonts/fontawesome.ttf b/tests/manual/testbench/fonts/fontawesome.ttf
new file mode 100755
index 00000000..49b6c5da
--- /dev/null
+++ b/tests/manual/testbench/fonts/fontawesome.ttf
Binary files differ
diff --git a/tests/manual/testbench/main.cpp b/tests/manual/testbench/main.cpp
index d8786941..0287537d 100644
--- a/tests/manual/testbench/main.cpp
+++ b/tests/manual/testbench/main.cpp
@@ -48,22 +48,45 @@
**
****************************************************************************/
+#include <QDebug>
+#include <QFontDatabase>
#include <QGuiApplication>
+#include <QSettings>
#include <QQmlApplicationEngine>
-#include <QtCore/private/qabstractanimation_p.h>
+#include <QQmlContext>
+#include <QQuickStyle>
+
+#include "assetfixer.h"
+#include "clipboard.h"
+#include "directoryvalidator.h"
int main(int argc, char *argv[])
{
+ QGuiApplication::setApplicationName("testbench");
+ QGuiApplication::setOrganizationName("QtProject");
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
QGuiApplication app(argc, argv);
- QUnifiedTimer::instance()->setSlowModeEnabled(app.arguments().contains("-slow"));
+ QSettings settings;
+ QString style = QQuickStyle::name();
+ if (!style.isEmpty())
+ settings.setValue("style", style);
+ else
+ QQuickStyle::setStyle(settings.value("style").isValid() ? settings.value("style").toString() : "Imagine");
+
+ if (QFontDatabase::addApplicationFont(":/fonts/fontawesome.ttf") == -1) {
+ qWarning() << "Failed to load fontawesome font";
+ }
- // These must be set before running.
- // TODO: move style selection into app UI and use settings to save choices.
- // qputenv("QT_QUICK_CONTROLS_STYLE", "material");
QQmlApplicationEngine engine;
+
+ qmlRegisterType<AssetFixer>("App", 1, 0, "AssetFixer");
+ qmlRegisterType<Clipboard>("App", 1, 0, "Clipboard");
+ qmlRegisterType<DirectoryValidator>("App", 1, 0, "DirectoryValidator");
+
+ engine.rootContext()->setContextProperty("availableStyles", QQuickStyle::availableStyles());
+
engine.load(QUrl(QStringLiteral("qrc:/testbench.qml")));
return app.exec();
diff --git a/tests/manual/testbench/qml.qrc b/tests/manual/testbench/qml.qrc
index 9f4b1783..85d7f5d3 100644
--- a/tests/manual/testbench/qml.qrc
+++ b/tests/manual/testbench/qml.qrc
@@ -1,5 +1,43 @@
<RCC>
<qresource prefix="/">
+ <file>ControlContainer.qml</file>
+ <file>controls/Button.qml</file>
+ <file>controls/CheckBox.qml</file>
+ <file>controls/RadioButton.qml</file>
+ <file>controls/CheckDelegate.qml</file>
+ <file>controls/ComboBox.qml</file>
+ <file>controls/DelayButton.qml</file>
+ <file>controls/Dial.qml</file>
+ <file>controls/Frame.qml</file>
+ <file>controls/GroupBox.qml</file>
+ <file>controls/ItemDelegate.qml</file>
+ <file>controls/Page.qml</file>
+ <file>controls/PageIndicator.qml</file>
+ <file>controls/Pane.qml</file>
+ <file>controls/ProgressBar.qml</file>
+ <file>controls/RadioDelegate.qml</file>
+ <file>controls/RangeSlider.qml</file>
+ <file>controls/RoundButton.qml</file>
+ <file>controls/ScrollBar.qml</file>
+ <file>controls/ScrollIndicator.qml</file>
+ <file>controls/Slider.qml</file>
+ <file>controls/SpinBox.qml</file>
+ <file>controls/SwipeDelegate.qml</file>
+ <file>controls/Switch.qml</file>
+ <file>controls/SwitchDelegate.qml</file>
+ <file>controls/TabBar.qml</file>
+ <file>controls/TextArea.qml</file>
+ <file>controls/TextField.qml</file>
+ <file>SettingsDialog.qml</file>
+ <file>ColorEditor.qml</file>
+ <file>controls/ToolBar.qml</file>
+ <file>controls/Dialog.qml</file>
+ <file>controls/Menu.qml</file>
+ <file>ExampleContainer.qml</file>
+ <file>controls/Label.qml</file>
+ <file>controls/ToolTip.qml</file>
+ <file>controls/Tumbler.qml</file>
+ <file>controls/BusyIndicator.qml</file>
<file>testbench.qml</file>
</qresource>
</RCC>
diff --git a/tests/manual/testbench/testbench.pro b/tests/manual/testbench/testbench.pro
index 082ca66f..829bcbde 100644
--- a/tests/manual/testbench/testbench.pro
+++ b/tests/manual/testbench/testbench.pro
@@ -1,11 +1,20 @@
TEMPLATE = app
-QT += qml quick core-private
+QT += qml quick quickcontrols2
CONFIG += c++11
-SOURCES += main.cpp
+HEADERS += \
+ assetfixer.h \
+ directoryvalidator.h \
+ clipboard.h
-RESOURCES += qml.qrc
+SOURCES += main.cpp \
+ assetfixer.cpp \
+ directoryvalidator.cpp \
+ clipboard.cpp
+
+RESOURCES += qml.qrc \
+ fonts.qrc
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
diff --git a/tests/manual/testbench/testbench.qml b/tests/manual/testbench/testbench.qml
index 4ec9b1ea..43f4465e 100644
--- a/tests/manual/testbench/testbench.qml
+++ b/tests/manual/testbench/testbench.qml
@@ -48,169 +48,132 @@
**
****************************************************************************/
-import QtQuick 2.9
+import QtQuick 2.10
import QtQuick.Window 2.3
import QtQuick.Layouts 1.2
import QtQuick.Controls 2.3
-import QtQuick.Controls.Material 2.3
-import QtQuick.Controls.Universal 2.3
+import QtQuick.Controls.Imagine 2.3
+import Qt.labs.folderlistmodel 1.0
+import Qt.labs.settings 1.0
+
+import App 1.0
ApplicationWindow {
id: window
visible: true
- width: 750
- height: 1000
-
- Component.onCompleted: {
- x = Screen.width / 2 - width / 2
- y = Screen.height / 2 - height / 2
+ width: 1000
+ height: 750
+ title: "Style Testbench - " + settings.style + " Style" + (usingImagineStyle ? imagineTitleText : "")
+
+ Imagine.path: defaultImaginePath
+
+ readonly property bool usingImagineStyle: settings.style.toLowerCase() === "imagine"
+ // Some controls should be visible regardless of whether or not custom assets are lacking for it,
+ // so we use the default assets in some cases.
+ readonly property string defaultImaginePath: "qrc:/qt-project.org/imports/QtQuick/Controls.2/Imagine/images/"
+ property bool settingsLoaded: false
+ readonly property string imagineTitleText: " - " + (settings.useCustomImaginePath ? settings.imaginePath : "Default Assets")
+
+ LoggingCategory {
+ id: brief
+ name: "qt.quick.controls.tools.testbench.assetfixer.brief"
}
- LayoutMirroring.childrenInherit: true
- LayoutMirroring.enabled: mirroredMenuItem.checked
-
- Material.theme: darkMenuItem.checked ? Material.Dark : Material.Light
- Universal.theme: darkMenuItem.checked ? Universal.Dark : Universal.Light
-
- property int controlSpacing: 10
+ Shortcut {
+ sequence: "Ctrl+F"
+ onActivated: searchTextField.forceActiveFocus()
+ }
Shortcut {
sequence: "Ctrl+Q"
onActivated: Qt.quit()
}
- header: ToolBar {
- Material.theme: Material.Dark
+ Action {
+ id: useCustomAssetsAction
+ text: qsTr("Use Custom Assets")
+ shortcut: "Ctrl+Shift+C"
+ enabled: usingImagineStyle
+ checkable: true
+ checked: settings.useCustomImaginePath
+ onTriggered: settings.useCustomImaginePath = !settings.useCustomImaginePath
+ }
- RowLayout {
- anchors.fill: parent
+ Action {
+ id: reloadAssetsAction
+ text: qsTr("Reload Assets")
+ shortcut: "Ctrl+R"
+ enabled: usingImagineStyle
+ onTriggered: assetFixer.reloadAssets()
+ }
- RowLayout {
- enabled: enabledMenuItem.checked
+ FontMetrics {
+ id: fontMetrics
+ }
- ToolButton {
- text: "\u2630"
- onClicked: drawer.open()
- }
+ Settings {
+ id: settings
- ToolSeparator {}
+ property alias windowX: window.x
+ property alias windowY: window.y
+ property alias windowWidth: window.width
+ property alias windowHeight: window.height
- ToolButton {
- text: "ToolButton"
- hoverEnabled: true
- ToolTip.text: text
- ToolTip.delay: 1000
- ToolTip.visible: hovered
- Layout.fillWidth: true
- }
- ToolButton {
- text: "Pressed"
- down: true
- hoverEnabled: true
- ToolTip.text: text
- ToolTip.delay: 1000
- ToolTip.visible: hovered
- Layout.fillWidth: true
- }
- ToolButton {
- text: "Checked"
- checkable: true
- checked: true
- hoverEnabled: true
- ToolTip.text: text
- ToolTip.delay: 1000
- ToolTip.visible: hovered
- Layout.fillWidth: true
- }
- ToolButton {
- text: "Highlighted"
- highlighted: true
- hoverEnabled: true
- ToolTip.text: text
- ToolTip.delay: 1000
- ToolTip.visible: hovered
- Layout.fillWidth: true
- }
- ToolButton {
- text: "Disabled"
- enabled: false
- Layout.fillWidth: true
- }
+ property string style: "Imagine"
- ToolSeparator {}
-
- ToolButton {
- id: menuButton
- text: "Menu"
- hoverEnabled: true
- checked: menu.visible
- checkable: true
- ToolTip.text: text
- ToolTip.delay: 1000
- ToolTip.visible: hovered
- Layout.fillWidth: true
+ property bool useCustomImaginePath
+ property string imaginePath
+ property bool fixImagineAssets
+ property alias imagineDirLastModified: assetFixer.assetDirectoryLastModified
- Menu {
- id: menu
- x: 1
- y: 1 + parent.height
- visible: menuButton.checked
- closePolicy: Popup.CloseOnPressOutsideParent
+ Component.onCompleted: settingsLoaded = true
+ }
- MenuItem {
- text: "MenuItem"
- }
- MenuItem {
- text: "Pressed"
- down: true
- }
- MenuItem {
- text: "Disabled"
- enabled: false
- }
+ Settings {
+ id: paletteSettings
+
+ category: "Palette"
+
+ property bool useCustomPalette
+ property string window
+ property string windowText
+ property string base
+ property string text
+ property string button
+ property string buttonText
+ property string brightText
+ property string toolTipBase
+ property string toolTipText
+ property string light
+ property string midlight
+ property string dark
+ property string mid
+ property string shadow
+ property string highlight
+ property string highlightedText
+ property string link
+ }
- MenuSeparator {}
+ header: ToolBar {
+ // Seems to be necessary to get the default assets to be used here,
+ // though it should inherit the window's path
+ Imagine.path: defaultImaginePath
- MenuItem {
- text: "Checked"
- checked: true
- }
- MenuItem {
- text: "CH+PR"
- checked: true
- down: true
- }
- MenuItem {
- text: "CH+DIS"
- checked: true
- enabled: false
- }
- }
- }
+ RowLayout {
+ anchors.fill: parent
- ToolButton {
- id: dialogButton
- text: "Dialog"
- hoverEnabled: true
- onClicked: dialog.open()
- ToolTip.text: text
- ToolTip.delay: 1000
- ToolTip.visible: hovered
- Layout.fillWidth: true
+ ToolButton {
+ text: "\uf0c9"
+ font.family: "fontawesome"
+ font.pixelSize: Qt.application.font.pixelSize * 1.6
+ onClicked: drawer.open()
+ }
- Dialog {
- id: dialog
- x: (window.width - width) / 2
- y: (window.height - height) / 2
- standardButtons: Dialog.Ok | Dialog.Cancel
- parent: window.contentItem
+ ToolSeparator {}
- Label {
- text: "Lorem ipsum dolor sit amet, \nconsectetuer adipiscing elit, \n"
- + "sed diam nonummy nibh euismod tincidunt ut \nlaoreet dolore magna aliquam erat volutpat."
- }
- }
- }
+ TextField {
+ id: searchTextField
+ placeholderText: "Search"
}
Item {
@@ -219,10 +182,14 @@ ApplicationWindow {
ToolButton {
id: optionsMenuButton
- text: "\u22EE" // VERTICAL ELLIPSIS
+ text: "\ue800"
+ font.family: "FontAwesome"
+ font.pixelSize: Qt.application.font.pixelSize * 1.6
checked: optionsMenu.visible
checkable: true
+ onClicked: optionsMenu.open()
+
Menu {
id: optionsMenu
x: 1
@@ -230,29 +197,34 @@ ApplicationWindow {
visible: optionsMenuButton.checked
closePolicy: Popup.CloseOnPressOutsideParent
+ Imagine.path: defaultImaginePath
+
MenuItem {
- id: enabledMenuItem
- text: "Enabled"
- checkable: true
- checked: true
+ text: qsTr("Open Asset Directory")
+ onClicked: Qt.openUrlExternally(assetFixer.assetDirectoryUrl)
+ enabled: usingImagineStyle
}
MenuItem {
- id: mirroredMenuItem
- text: "Mirrored"
- checkable: true
+ action: reloadAssetsAction
}
MenuItem {
- id: darkMenuItem
- text: "Dark"
- checkable: true
+ action: useCustomAssetsAction
}
MenuSeparator {}
MenuItem {
- text: "Quit"
+ id: settingsMenuItem
+ text: qsTr("Settings")
+ onTriggered: settingsDialog.open()
+ }
+
+ MenuSeparator {}
+
+ MenuItem {
+ text: qsTr("Quit")
onTriggered: Qt.quit()
}
}
@@ -260,838 +232,268 @@ ApplicationWindow {
}
}
- footer: TabBar {
- enabled: enabledMenuItem.checked
- TabButton {
- text: "TabButton"
- }
- TabButton {
- text: "Pressed"
- down: true
- }
- TabButton {
- text: "Disabled"
- enabled: false
- }
+ SettingsDialog {
+ id: settingsDialog
+
+ Imagine.path: defaultImaginePath
}
- Pane {
- anchors.fill: parent
+ Drawer {
+ id: drawer
+ width: parent.width * 0.33
+ height: window.height
+ focus: false
+ modal: false
- Drawer {
- id: drawer
- width: parent.width * 0.33
- height: parent.height
+ Label {
+ text: "Drawer contents go here"
+ anchors.centerIn: parent
}
+ }
- Flickable {
- anchors.fill: parent
- contentHeight: flow.height
-
- Flow {
- id: flow
- width: parent.width
- spacing: 30
- enabled: enabledMenuItem.checked
-
- RowLayout {
- spacing: window.controlSpacing
-
- Button {
- text: "Button"
- }
- Button {
- text: "Pressed"
- down: true
- }
- Button {
- text: "Checked"
- checked: true
- }
- Button {
- text: "CH + PR"
- checked: true
- down: true
- }
- Button {
- text: "Disabled"
- enabled: false
- }
- Button {
- text: "CH + DIS"
- enabled: false
- checked: true
- }
- }
-
- RowLayout {
- spacing: window.controlSpacing
-
- Button {
- text: "HI"
- highlighted: true
- }
- Button {
- text: "HI + PR"
- highlighted: true
- down: true
- }
- Button {
- text: "HI + CH"
- highlighted: true
- checked: true
- }
- Button {
- text: "HI+CH+PR"
- highlighted: true
- down: true
- checked: true
- }
- Button {
- text: "HI + DIS"
- highlighted: true
- enabled: false
- }
- Button {
- text: "HI+CH+DIS"
- highlighted: true
- enabled: false
- checked: true
- }
- }
-
- RowLayout {
- spacing: window.controlSpacing
-
- Button {
- text: "Flat"
- flat: true
- }
- Button {
- text: "Flat+PR"
- down: true
- flat: true
- }
- Button {
- text: "Flat+CH"
- checked: true
- flat: true
- }
- Button {
- text: "Flat+CH+PR"
- checked: true
- down: true
- flat: true
- }
- Button {
- text: "Flat+DIS"
- enabled: false
- flat: true
- }
- }
-
- RowLayout {
- spacing: window.controlSpacing
-
- DelayButton {
- text: "DelayButton"
- }
- DelayButton {
- text: "Pressed"
- down: true
- }
- DelayButton {
- text: "Checked"
- checked: true
- }
- DelayButton {
- text: "CH + PR"
- checked: true
- down: true
- }
- DelayButton {
- text: "Disabled"
- enabled: false
- }
- DelayButton {
- text: "CH + DIS"
- enabled: false
- checked: true
- }
- }
-
- RowLayout {
- spacing: window.controlSpacing * 2
-
- ColumnLayout {
- RoundButton {
- highlighted: true
- Layout.alignment: Qt.AlignHCenter
- }
- Label {
- text: "HI"
- Layout.alignment: Qt.AlignHCenter
- }
- }
- ColumnLayout {
- RoundButton {
- highlighted: true
- down: true
- Layout.alignment: Qt.AlignHCenter
- }
- Label {
- text: "HI + PR"
- Layout.alignment: Qt.AlignHCenter
- }
- }
- ColumnLayout {
- RoundButton {
- highlighted: true
- checked: true
- Layout.alignment: Qt.AlignHCenter
- }
- Label {
- text: "HI + CH"
- Layout.alignment: Qt.AlignHCenter
- }
- }
- ColumnLayout {
- RoundButton {
- highlighted: true
- down: true
- checked: true
- Layout.alignment: Qt.AlignHCenter
- }
- Label {
- text: "HI+CH+PR"
- Layout.alignment: Qt.AlignHCenter
- }
- }
- ColumnLayout {
- RoundButton {
- highlighted: true
- enabled: false
- Layout.alignment: Qt.AlignHCenter
- }
- Label {
- text: "HI + DIS"
- Layout.alignment: Qt.AlignHCenter
- }
- }
- ColumnLayout {
- RoundButton {
- highlighted: true
- enabled: false
- checked: true
- Layout.alignment: Qt.AlignHCenter
- }
- Label {
- text: "HI+CH+DIS"
- Layout.alignment: Qt.AlignHCenter
- }
- }
- }
+ AssetFixer {
+ id: assetFixer
+ assetDirectory: settings.imaginePath
+ // Don't start watching until the settings have loaded, as AssetFixer can be completed before it.
+ // AssetFixer needs the settings in order to check the last modified time of the asset directory.
+ // Also, wait until the UI has been rendered for the first time so that we can show our busy indicators, etc.
+ shouldWatch: usingImagineStyle && settings.useCustomImaginePath && settingsLoaded && initialUiRenderDelayTimer.hasRun
+ shouldFix: shouldWatch && settings.fixImagineAssets
+
+ onFixSuggested: fixEmUp()
+ onDelayedFixSuggested: assetFixerFileSystemDelayTimer.restart()
+ onReloadSuggested: reloadAssets()
+
+ function reloadAssets() {
+ console.log(brief, "Reloading assets...")
+ window.Imagine.path = ""
+ assetReloadNextFrameTimer.start()
+ }
- RowLayout {
- CheckBox {
- text: "CheckBox"
- }
- CheckBox {
- text: "Pressed"
- down: true
- }
- CheckBox {
- text: "Checked"
- checked: true
- }
- CheckBox {
- text: "CH + PR"
- checked: true
- down: true
- }
- CheckBox {
- text: "Disabled"
- enabled: false
- }
- CheckBox {
- text: "CH + DIS"
- checked: true
- enabled: false
- }
- }
+ function fixEmUp() {
+ // This is a bit of a hack, but I can't think of a nice way to solve it.
+ // The problem is that shouldWatch becomes true, causing startWatching() to be called.
+ // If a fix is suggested as a result of that, this function is called.
+ // However, the shouldFix binding hasn't been updated yet, so even though shouldWatch
+ // and settings.fixImagineAssets are both true (the properties that make up its binding),
+ // the if check below fails. So, we check for that case with effectiveShouldFix.
+ var effectiveShouldFix = shouldWatch && settings.fixImagineAssets;
+ if (shouldWatch && effectiveShouldFix && assetDirectory.length > 0) {
+ // Disable image caching if it hasn't already been done.
+ assetFixer.clearImageCache()
+
+ busyIndicatorRow.visible = true
+ assetFixerAnimationDelayTimer.start()
+ }
+ }
+ }
- RowLayout {
- CheckBox {
- text: "Tri-state\nCheckBox"
- tristate: true
- }
- CheckBox {
- text: "Pressed"
- down: true
- tristate: true
- }
- CheckBox {
- text: "Partially\nChecked"
- tristate: true
- checkState: Qt.PartiallyChecked
- }
- CheckBox {
- text: "CH + PR"
- tristate: true
- checkState: Qt.PartiallyChecked
- down: true
- }
- CheckBox {
- text: "Disabled"
- tristate: true
- enabled: false
- }
- CheckBox {
- text: "CH + DIS"
- tristate: true
- checkState: Qt.PartiallyChecked
- enabled: false
- }
- }
+ // The controls' assets don't always "reload" if the path is cleared and then set in the same frame,
+ // so we delay the setting to the next frame.
+ Timer {
+ id: assetReloadNextFrameTimer
+ interval: 0
+ onTriggered: {
+ window.Imagine.path = Qt.binding(function() {
+ return settings.useCustomImaginePath && settings.imaginePath.length > 0 ? settings.imaginePath : undefined
+ })
+ infoToolTip.text = "Reloaded assets"
+ infoToolTip.timeout = 1500
+ infoToolTip.open()
+ console.log(brief, "... reloaded assets.")
+ }
+ }
- RowLayout {
- RadioButton {
- text: "RadioButton"
- }
- RadioButton {
- text: "Pressed"
- down: true
- }
- RadioButton {
- text: "Checked"
- checked: true
- }
- RadioButton {
- text: "CH + PR"
- checked: true
- down: true
- }
- RadioButton {
- text: "Disabled"
- enabled: false
- }
- RadioButton {
- text: "CH + DIS"
- checked: true
- enabled: false
- }
- }
+ // When exporting or deleting a large amount of assets (not uncommon),
+ // the filesystem watcher seems to emit directoryChanged() every second or so,
+ // so rather than process hundreds of assets every time we get notified, delay
+ // it until we haven't been notified for a while.
+ Timer {
+ id: assetFixerFileSystemDelayTimer
+ interval: 2000
+ onRunningChanged: {
+ if (running) {
+ infoToolTip.text = "Assets changed on disk - reloading in 2 seconds if no further changes are detected"
+ infoToolTip.timeout = 2000
+ infoToolTip.open()
+ }
+ }
+ onTriggered: assetFixer.fixEmUp()
+ }
- RowLayout {
- Switch {
- text: "Switch"
- }
- Switch {
- text: "Pressed"
- down: true
- }
- Switch {
- text: "Checked"
- checked: true
- }
- Switch {
- text: "CH + PR"
- checked: true
- down: true
- }
- Switch {
- text: "Disabled"
- enabled: false
- }
- Switch {
- text: "CH + DIS"
- checked: true
- enabled: false
- }
- }
+ // Gives the BusyIndicator animation a chance to start.
+ Timer {
+ id: assetFixerAnimationDelayTimer
+ interval: 100
+ onTriggered: {
+ assetFixer.fixAssets()
+ busyIndicatorRow.visible = false
+ }
+ }
- RowLayout {
- ProgressBar {
- value: slider.value
- }
- ProgressBar {
- value: 0.5
- indeterminate: true
- }
- ProgressBar {
- value: 0.5
- enabled: false
- }
- }
+ // Gives the UI a chance to render before the initial fixup.
+ Timer {
+ id: initialUiRenderDelayTimer
+ interval: 300
+ running: true
+ onTriggered: hasRun = true
- RowLayout {
- Slider {
- id: slider
- value: 0.5
- }
- Slider {
- value: 0.5
- pressed: true
- }
- Slider {
- value: 0.5
- enabled: false
- }
- }
+ property bool hasRun: 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
- }
- }
+ function getControlElements(control) {
+ var props = [];
+ for (var p in control) {
+ if (p !== "component" && typeof control[p] === 'object')
+ props.push(p);
+ }
+ return props;
+ }
- RowLayout {
- spacing: window.controlSpacing * 2
+ Pane {
+ id: contentPane
+ anchors.fill: parent
- TextArea {
- text: "TextArea"
- Layout.preferredWidth: normalGroupBox.implicitWidth
- }
+ Imagine.path: settings.useCustomImaginePath && settings.imaginePath.length > 0 ? settings.imaginePath : undefined
+
+ palette.window: effectiveColor(paletteSettings.window)
+ palette.windowText: effectiveColor(paletteSettings.windowText)
+ palette.base: effectiveColor(paletteSettings.base)
+ palette.text: effectiveColor(paletteSettings.text)
+ palette.button: effectiveColor(paletteSettings.button)
+ palette.buttonText: effectiveColor(paletteSettings.buttonText)
+ palette.brightText: effectiveColor(paletteSettings.brightText)
+ palette.toolTipBase: effectiveColor(paletteSettings.toolTipBase)
+ palette.toolTipText: effectiveColor(paletteSettings.toolTipText)
+ palette.light: effectiveColor(paletteSettings.light)
+ palette.midlight: effectiveColor(paletteSettings.midlight)
+ palette.dark: effectiveColor(paletteSettings.dark)
+ palette.mid: effectiveColor(paletteSettings.mid)
+ palette.shadow: effectiveColor(paletteSettings.shadow)
+ palette.highlight: effectiveColor(paletteSettings.highlight)
+ palette.highlightedText: effectiveColor(paletteSettings.highlightedText)
+ palette.link: effectiveColor(paletteSettings.link)
+
+ function effectiveColor(paletteColorString) {
+ return paletteSettings.useCustomPalette && paletteColorString.length > 0 ? paletteColorString : undefined
+ }
- TextArea {
- placeholderText: "Placeholder"
- Layout.preferredWidth: normalGroupBox.implicitWidth
- }
+ ListView {
+ anchors.fill: parent
+ spacing: 30
+ visible: !busyIndicatorRow.visible
- TextArea {
- text: "Disabled"
- enabled: false
- Layout.preferredWidth: normalGroupBox.implicitWidth
- }
- }
+ ScrollBar.vertical: ScrollBar {}
- RowLayout {
- spacing: window.controlSpacing * 2
+ model: FolderListModel {
+ folder: "qrc:/controls"
+ showDirs: false
+ nameFilters: searchTextField.text.length > 0 ? ["*" + searchTextField.text + "*.qml"] : []
+ }
+ delegate: ColumnLayout {
+ id: rootDelegate
+ width: parent.width
- TextField {
- text: "TextField"
- }
- TextField {
- placeholderText: "Placeholder"
- }
- TextField {
- text: "Disabled"
- enabled: false
- }
+ MenuSeparator {
+ Layout.fillWidth: true
+ visible: index !== 0
}
- RowLayout {
- spacing: window.controlSpacing * 2
-
- SpinBox {
- id: normalSpinBox
- }
- SpinBox {
- up.pressed: true
- }
- SpinBox {
- editable: true
- }
- SpinBox {
- enabled: false
- }
+ Label {
+ text: customControlName.length === 0 ? model.fileBaseName : customControlName
+ font.pixelSize: Qt.application.font.pixelSize * 2
}
- RowLayout {
- spacing: window.controlSpacing * 2
-
- ComboBox {
- model: 5
- }
-
- ComboBox {
- pressed: true
- model: ["Pressed"]
- }
-
- ComboBox {
- editable: true
- model: ListModel {
- id: fruitModel
- ListElement { text: "Banana" }
- ListElement { text: "Apple" }
- ListElement { text: "Coconut" }
- }
- onAccepted: {
- if (find(editText) === -1)
- fruitModel.append({text: editText})
- }
- }
-
- ComboBox {
- enabled: false
- model: ["Disabled"]
+ readonly property var controlName: model.fileBaseName
+ readonly property var controlMetaObject: controlMetaObjectLoader.item
+ readonly property string customControlName: controlMetaObject && controlMetaObject.hasOwnProperty("customControlName")
+ ? controlMetaObject.customControlName : ""
+ readonly property var supportedStates: rootDelegate.controlMetaObject.supportedStates
+ readonly property int maxStateCombinations: {
+ var largest = 0;
+ for (var i = 0; i < supportedStates.length; ++i) {
+ var combinations = supportedStates[i];
+ if (combinations.length > largest)
+ largest = combinations.length;
}
+ return largest;
}
- ListModel {
- id: checkableDelegateModel
- ListElement { label: "Pressed"; press: true }
- ListElement { label: "Checked"; check: true }
- ListElement { label: "CH + PR"; check: true; press: true }
- ListElement { label: "Disabled"; disabled: true }
- ListElement { label: "CH + DIS"; check: true; disabled: true }
+ Loader {
+ id: controlMetaObjectLoader
+ source: "qrc" + model.filePath
}
- RowLayout {
- Frame {
- Column {
- width: 200
-
- CheckDelegate {
- text: "CheckDelegate"
- width: parent.width
- focusPolicy: Qt.StrongFocus
- }
-
- Repeater {
- model: checkableDelegateModel
- delegate: CheckDelegate {
- text: label
- width: parent.width
- down: press
- checked: check
- enabled: !disabled
- focusPolicy: Qt.StrongFocus
- }
- }
- }
- }
-
- Frame {
- Column {
- width: 200
-
- RadioDelegate {
- text: "RadioDelegate"
- width: parent.width
- focusPolicy: Qt.StrongFocus
- }
-
- Repeater {
- model: checkableDelegateModel
- delegate: RadioDelegate {
- text: label
- down: press
- width: parent.width
- checked: check
- enabled: !disabled
- focusPolicy: Qt.StrongFocus
- }
- }
- }
- }
-
- Frame {
- Column {
- width: 200
+ Flow {
+ spacing: 10
- SwitchDelegate {
- text: "SwitchDelegate"
- width: parent.width
- focusPolicy: Qt.StrongFocus
- }
+ Layout.fillWidth: true
- Repeater {
- model: checkableDelegateModel
- delegate: SwitchDelegate {
- text: label
- width: parent.width
- checked: check
- down: press
- enabled: !disabled
- focusPolicy: Qt.StrongFocus
- }
- }
- }
- }
- }
+ Repeater {
+ id: stateRepeater
+ model: rootDelegate.supportedStates
- ListModel {
- id: regularDelegateModel
- ListElement { label: "Pressed"; press: true }
- ListElement { label: "Disabled"; disabled: true }
- }
+ ColumnLayout {
+ id: labelWithDelegatesColumn
+ spacing: 4
- RowLayout {
- Frame {
- Column {
- width: 200
+ readonly property var states: modelData
+ readonly property string statesAsString: states.join("\n")
- ItemDelegate {
- text: "ItemDelegate"
- width: parent.width
- focusPolicy: Qt.StrongFocus
- }
+ Label {
+ text: statesAsString.length > 0 ? statesAsString : "normal"
- Repeater {
- model: regularDelegateModel
- delegate: ItemDelegate {
- text: label
- width: parent.width
- down: press
- enabled: !disabled
- focusPolicy: Qt.StrongFocus
- }
- }
- }
- }
- Frame {
- Column {
- id: listView
- width: 200
- clip: true
-
- SwipeDelegate {
- text: "SwipeDelegate"
- width: parent.width
- swipe.left: removeComponent
- swipe.right: removeComponent
- focusPolicy: Qt.StrongFocus
+ // 4 is the most states for any element (Button)
+ Layout.preferredHeight: (fontMetrics.lineSpacing) * (rootDelegate.maxStateCombinations + 1)
}
- Repeater {
- model: regularDelegateModel
- delegate: SwipeDelegate {
- text: label
- width: parent.width
- down: press
- enabled: !disabled
- focusPolicy: Qt.StrongFocus
-
- swipe.left: removeComponent
- swipe.right: removeComponent
- }
- }
+ ControlContainer {
+ id: controlContainer
+ objectName: controlName + "ControlContainer"
+ controlMetaObject: rootDelegate.controlMetaObject
+ states: labelWithDelegatesColumn.states
- Component {
- id: removeComponent
-
- Rectangle {
- color: parent.swipe.complete && parent.pressed ? "#333" : "#444"
- width: parent.width
- height: parent.height
- clip: true
-
- Label {
- font.pixelSize: parent.parent.font.pixelSize
- text: "Boop"
- color: "white"
- anchors.centerIn: parent
- }
- }
+ Layout.alignment: Qt.AlignHCenter
}
}
}
}
- RowLayout {
- Frame {
- padding: 0
- Layout.preferredWidth: 100
- Layout.preferredHeight: 100
-
- ScrollIndicator {
- size: 0.6
- position: 0.1
- active: true
- orientation: Qt.Vertical
- height: parent.height
- anchors.right: parent.right
- }
- }
-
- Frame {
- padding: 0
- Layout.preferredWidth: 100
- Layout.preferredHeight: 100
-
- ScrollIndicator {
- size: 0.6
- position: 0.1
- active: true
- orientation: Qt.Vertical
- height: parent.height
- anchors.right: parent.right
- enabled: false
- }
- }
- }
-
- RowLayout {
- Frame {
- id: scrollBarFrame
-
- padding: 0
- contentWidth: 200
- contentHeight: 100
-
- Label {
- text: "ScrollBar"
- anchors.centerIn: parent
- }
-
- ScrollBar {
- size: 0.6
- position: 0.1
- policy: ScrollBar.AlwaysOn
- orientation: Qt.Vertical
- height: parent.height
- anchors.right: parent.right
- }
- }
-
- Frame {
- padding: 0
- contentWidth: 200
- contentHeight: 100
-
- Label {
- text: "Pressed"
- anchors.centerIn: parent
- }
-
- ScrollBar {
- size: 0.6
- position: 0.1
- policy: ScrollBar.AlwaysOn
- orientation: Qt.Vertical
- height: parent.height
- anchors.right: parent.right
- pressed: true
- }
- }
-
- Frame {
- padding: 0
- contentWidth: 200
- contentHeight: 100
- enabled: false
-
- Label {
- text: "Disabled"
- anchors.centerIn: parent
- }
-
- ScrollBar {
- size: 0.6
- position: 0.1
- policy: ScrollBar.AlwaysOn
- orientation: Qt.Vertical
- height: parent.height
- anchors.right: parent.right
- }
- }
- }
-
- RowLayout {
- GroupBox {
- id: normalGroupBox
- title: "GroupBox"
-
- contentWidth: 200
- contentHeight: 100
-
- BusyIndicator {
- anchors.centerIn: parent
- }
-
- PageIndicator {
- count: 5
- interactive: true
- anchors.bottom: parent.bottom
- anchors.horizontalCenter: parent.horizontalCenter
- }
- }
- GroupBox {
- enabled: false
- title: "Disabled"
-
- contentWidth: 200
- contentHeight: 100
-
- BusyIndicator {
- anchors.centerIn: parent
- }
+ ExampleContainer {
+ id: exampleContainer
+ controlMetaObject: rootDelegate.controlMetaObject
+ visible: !!controlMetaObject.exampleComponent
- PageIndicator {
- count: 5
- anchors.bottom: parent.bottom
- anchors.horizontalCenter: parent.horizontalCenter
- }
- }
- GroupBox {
- enabled: false
- title: "."
- label.visible: false
-
- contentWidth: 200
- contentHeight: 100
-
- PageIndicator {
- count: 5
- anchors.bottom: parent.bottom
- anchors.horizontalCenter: parent.horizontalCenter
- }
- }
+ Layout.alignment: Qt.AlignHCenter
+ Layout.topMargin: visible ? 14 : 0
+ Layout.fillWidth: true
+ Layout.preferredHeight: visible ? implicitHeight : 0
}
+ }
+ }
+ }
- RowLayout {
- Dial {
- value: 0.5
- implicitWidth: 100
- implicitHeight: 100
- }
- Dial {
- value: 0.5
- implicitWidth: 100
- implicitHeight: 100
- enabled: false
- }
- }
+ RowLayout {
+ id: busyIndicatorRow
+ anchors.centerIn: parent
+ visible: false
- RowLayout {
- Frame {
- Tumbler {
- id: tumbler
- model: 10
- implicitWidth: 60
- implicitHeight: 200
- }
- }
- Frame {
- Tumbler {
- model: 10
- implicitWidth: 60
- implicitHeight: 200
- enabled: false
- }
- }
- }
- }
+ BusyIndicator {
+ id: busyIndicator
+ running: visible
+ }
- ScrollBar.vertical: ScrollBar {
- parent: window.contentItem
- x: parent.width - width
- height: parent.height
- }
+ Label {
+ text: qsTr("Fixing assets...")
+ font.pixelSize: Qt.application.font.pixelSize * 2
}
}
+
+ ToolTip {
+ id: infoToolTip
+ x: (parent.width - width) / 2
+ y: parent.height - height - 40
+ parent: window.contentItem
+ }
}