diff options
author | Mitch Curtis <mitch.curtis@qt.io> | 2020-09-04 16:53:42 +0200 |
---|---|---|
committer | Mitch Curtis <mitch.curtis@qt.io> | 2020-09-07 14:55:09 +0200 |
commit | 613ec309c1456783ef3a5e29532bdbce06e91a49 (patch) | |
tree | 6aee59750d9a996d82ed1475514c59af3ae00f28 /tests | |
parent | 52ae6b1a506bea501ac7db424edddfa18383d20a (diff) | |
parent | aad71282b241402be356531804fede4b43ee5659 (diff) |
Merge "Merge remote-tracking branch 'nativestyle' into dev"
Diffstat (limited to 'tests')
37 files changed, 3207 insertions, 1 deletions
diff --git a/tests/auto/controls/data/tst_switch.qml b/tests/auto/controls/data/tst_switch.qml index 876af1ba..9050964f 100644 --- a/tests/auto/controls/data/tst_switch.qml +++ b/tests/auto/controls/data/tst_switch.qml @@ -606,6 +606,7 @@ TestCase { verify(!control.activeFocus) mouseClick(control.indicator) - verify(control.activeFocus) + // should not get activeFocus on mouseClick on macOS + compare(control.activeFocus, Qt.platform.os !== "osx" && Qt.platform.os !== "macos") } } diff --git a/tests/manual/nativestyle/.gitignore b/tests/manual/nativestyle/.gitignore new file mode 100644 index 00000000..fab7372d --- /dev/null +++ b/tests/manual/nativestyle/.gitignore @@ -0,0 +1,73 @@ +# This file is used to ignore files which are generated +# ---------------------------------------------------------------------------- + +*~ +*.autosave +*.a +*.core +*.moc +*.o +*.obj +*.orig +*.rej +*.so +*.so.* +*_pch.h.cpp +*_resource.rc +*.qm +.#* +*.*# +core +!core/ +tags +.DS_Store +.directory +*.debug +Makefile* +*.prl +*.app +moc_*.cpp +ui_*.h +qrc_*.cpp +Thumbs.db +*.res +*.rc +/.qmake.cache +/.qmake.stash + +# qtcreator generated files +*.pro.user* + +# xemacs temporary files +*.flc + +# Vim temporary files +.*.swp + +# Visual Studio generated files +*.ib_pdb_index +*.idb +*.ilk +*.pdb +*.sln +*.suo +*.vcproj +*vcproj.*.*.user +*.ncb +*.sdf +*.opensdf +*.vcxproj +*vcxproj.* + +# MinGW generated files +*.Debug +*.Release + +# Python byte code +*.pyc + +# Binaries +# -------- +*.dll +*.exe + diff --git a/tests/manual/nativestyle/Buttons.qml b/tests/manual/nativestyle/Buttons.qml new file mode 100644 index 00000000..d5eb2a9c --- /dev/null +++ b/tests/manual/nativestyle/Buttons.qml @@ -0,0 +1,100 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "Buttons" + + Row { + spacing: container.rowSpacing + + Button { + text: "Default" + } + + Button { + text: "Disabled" + enabled: false + } + + Button { + text: "Small" + property bool qqc2_style_small + } + + Button { + text: "Mini" + property bool qqc2_style_mini + } + } + + Row { + spacing: container.rowSpacing + + Button { + text: "Explicit height" + height: 50 + } + + Button { + text: "Explicit width" + width: 200 + } + } + + Row { + spacing: container.rowSpacing + + Button { + text: "Highlighted" + highlighted: true + } + + Button { + text: "Flat" + flat: true + } + + Button { + text: "Checkable" + checkable: true + } + } +} diff --git a/tests/manual/nativestyle/CMakeLists.txt b/tests/manual/nativestyle/CMakeLists.txt new file mode 100644 index 00000000..e4712a6e --- /dev/null +++ b/tests/manual/nativestyle/CMakeLists.txt @@ -0,0 +1,80 @@ +# Generated from desktopgallery.pro. + +cmake_minimum_required(VERSION 3.14) +project(desktopgallery LANGUAGES CXX) + +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_AUTOUIC ON) + +if(NOT DEFINED INSTALL_EXAMPLESDIR) + set(INSTALL_EXAMPLESDIR "examples") +endif() + +set(INSTALL_EXAMPLEDIR "${INSTALL_EXAMPLESDIR}/quickcontrols2/desktopgallery") + +find_package(Qt6 COMPONENTS Core) +find_package(Qt6 COMPONENTS Gui) +find_package(Qt6 COMPONENTS Quick) +find_package(Qt6 COMPONENTS QuickControls2) + +add_qt_gui_executable(desktopgallery + main.cpp +) +target_link_libraries(desktopgallery PUBLIC + Qt::Core + Qt::Gui + Qt::Quick + Qt::QuickControls2 +) + + +# Resources: +set(qmake_immediate_resource_files + "Buttons.qml" + "CheckBoxes.qml" + "ComboBoxes.qml" + "ControlContainer.qml" + "CustomButtons.qml" + "CustomCheckBoxes.qml" + "CustomComboBoxes.qml" + "CustomDials.qml" + "CustomFrames.qml" + "CustomProgressBars.qml" + "CustomRadioButtons.qml" + "CustomScrollBars.qml" + "CustomSliders.qml" + "CustomSpinBoxes.qml" + "CustomTextAreas.qml" + "CustomTextFields.qml" + "Dials.qml" + "Frames.qml" + "ProgressBars.qml" + "RadioButtons.qml" + "ScrollBars.qml" + "Sliders.qml" + "SlidersMini.qml" + "SlidersSmall.qml" + "SpinBoxes.qml" + "TextAreas.qml" + "TextFields.qml" + "checkbox-icon.png" + "checkbox-icon16.png" + "checkbox-icon@2x.png" + "main.qml" +) + +qt6_add_resources(desktopgallery "qmake_immediate" + PREFIX + "/" + FILES + ${qmake_immediate_resource_files} +) + +install(TARGETS desktopgallery + RUNTIME DESTINATION "${INSTALL_EXAMPLEDIR}" + BUNDLE DESTINATION "${INSTALL_EXAMPLEDIR}" + LIBRARY DESTINATION "${INSTALL_EXAMPLEDIR}" +) diff --git a/tests/manual/nativestyle/CheckBoxes.qml b/tests/manual/nativestyle/CheckBoxes.qml new file mode 100644 index 00000000..c24e9a54 --- /dev/null +++ b/tests/manual/nativestyle/CheckBoxes.qml @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "CheckBoxes" + + Row { + spacing: container.rowSpacing + + CheckBox { + text: "Default" + checked: true + } + + CheckBox { + text: "Disabled" + enabled: false + } + + CheckBox { + text: "Tri-state" + tristate: true + checkState: Qt.PartiallyChecked + } + + CheckBox { + text: "Small" + property bool qqc2_style_small + } + + CheckBox { + text: "Mini" + property bool qqc2_style_mini + checked: true + } + } +} diff --git a/tests/manual/nativestyle/ComboBoxes.qml b/tests/manual/nativestyle/ComboBoxes.qml new file mode 100644 index 00000000..21dd5b09 --- /dev/null +++ b/tests/manual/nativestyle/ComboBoxes.qml @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "ComboBoxes" + + Row { + spacing: container.rowSpacing + + ComboBox { + model: [ "Default", "Banana", "Apple", "Coconut" ] + } + + ComboBox { + model: [ "Disabled", "Banana", "Apple", "Coconut" ] + enabled: false + } + + ComboBox { + model: [ "Small", "Banana", "Apple", "Coconut" ] + property bool qqc2_style_small + } + + ComboBox { + model: [ "Mini", "Banana", "Apple", "Coconut" ] + property bool qqc2_style_mini + } + } + + Row { + spacing: container.rowSpacing + + ComboBox { + model: [ "Default", "Banana", "Apple", "Coconut" ] + editable: true + } + + ComboBox { + model: [ "Disabled", "Banana", "Apple", "Coconut" ] + enabled: false + editable: true + } + + ComboBox { + model: [ "Small", "Banana", "Apple", "Coconut" ] + editable: true + property bool qqc2_style_small + } + + ComboBox { + model: [ "Mini", "Banana", "Apple", "Coconut" ] + editable: true + property bool qqc2_style_mini + } + } +} diff --git a/tests/manual/nativestyle/ControlContainer.qml b/tests/manual/nativestyle/ControlContainer.qml new file mode 100644 index 00000000..f528e994 --- /dev/null +++ b/tests/manual/nativestyle/ControlContainer.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +Item { + anchors.left: parent.left + anchors.right: parent.right + anchors.rightMargin: 20 // make room for scrollbar + implicitHeight: groupBox.height + + property alias title: groupBox.title + property real rowSpacing: 20 + + default property alias data: layout.data + + GroupBox { + id: groupBox + anchors.left: parent.left + anchors.right: parent.right + + ColumnLayout { + id: layout + spacing: 15 + } + } +} diff --git a/tests/manual/nativestyle/CustomButtons.qml b/tests/manual/nativestyle/CustomButtons.qml new file mode 100644 index 00000000..6a01faed --- /dev/null +++ b/tests/manual/nativestyle/CustomButtons.qml @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "Buttons" + + Row { + spacing: container.rowSpacing + + Button { + id: buttonWithCustomContentItem + text: "Custom contentItem" + contentItem: Rectangle { + implicitWidth: 120 + implicitHeight: il.implicitHeight + color: buttonWithCustomContentItem.pressed ? "green" : "lightGreen" + Text { + id: il + text: buttonWithCustomContentItem.text + anchors.centerIn: parent + } + } + } + + Button { + id: cb + text: "Custom background" + background: Rectangle { + implicitWidth: 200 + implicitHeight: 30 + radius: 5 + color: cb.pressed ? "LightGray" : "gray" + } + } + + Button { + id: cb2 + text: "All custom" + background: Rectangle { + implicitWidth: 200 + implicitHeight: 30 + radius: 5 + color: cb2.pressed ? "LightGray" : "gray" + } + contentItem: Rectangle { + implicitWidth: il2.implicitWidth + implicitHeight: il2.implicitHeight + radius: 3 + color: "lightgray" + Text { + id: il2 + text: cb2.text + anchors.centerIn: parent + } + } + } + } +} diff --git a/tests/manual/nativestyle/CustomCheckBoxes.qml b/tests/manual/nativestyle/CustomCheckBoxes.qml new file mode 100644 index 00000000..ce3a5543 --- /dev/null +++ b/tests/manual/nativestyle/CustomCheckBoxes.qml @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick.Controls.impl + +ControlContainer { + id: container + title: "CheckBoxes" + + Row { + spacing: container.rowSpacing + + CheckBox { + id: customContentItem + text: "Custom content item" + contentItem: Text { + text: customContentItem.text + color: "green" + leftPadding: customContentItem.indicator.width + customContentItem.spacing + } + } + + CheckBox { + id: customIndicator + text: "Custom indicator" + indicator: Rectangle { + implicitWidth: 15 + implicitHeight: 15 + + x: customIndicator.text ? customIndicator.leftPadding : customIndicator.leftPadding + (customIndicator.availableWidth - width) / 2 + y: customIndicator.topPadding + (customIndicator.availableHeight - height) / 2 + + color: customIndicator.down ? customIndicator.palette.light : customIndicator.palette.base + border.color: "green" + border.width: 2 + + ColorImage { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + defaultColor: "#353637" + scale: 0.5 + color: "green" + source: "qrc:/qt-project.org/imports/QtQuick/Controls/Default/images/check.png" + visible: customIndicator.checkState === Qt.Checked + } + + Rectangle { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: 16 + height: 3 + color: customIndicator.palette.text + visible: customIndicator.checkState === Qt.PartiallyChecked + } + } + } + + CheckBox { + id: allCustom + text: "All custom" + + contentItem: Text { + text: allCustom.text + color: "green" + leftPadding: allCustom.indicator.width + allCustom.spacing + rightPadding: allCustom.indicator.width + allCustom.spacing + } + + indicator: Rectangle { + implicitWidth: 15 + implicitHeight: 15 + + x: allCustom.text ? allCustom.leftPadding : allCustom.leftPadding + (allCustom.availableWidth - width) / 2 + y: allCustom.topPadding + (allCustom.availableHeight - height) / 2 + + color: allCustom.down ? allCustom.palette.light : allCustom.palette.base + border.color: "green" + border.width: 2 + + ColorImage { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + defaultColor: "#353637" + scale: 0.5 + color: "green" + source: "qrc:/qt-project.org/imports/QtQuick/Controls/Default/images/check.png" + visible: allCustom.checkState === Qt.Checked + } + + Rectangle { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: 16 + height: 3 + color: "green" + visible: allCustom.checkState === Qt.PartiallyChecked + } + } + } + } +} diff --git a/tests/manual/nativestyle/CustomComboBoxes.qml b/tests/manual/nativestyle/CustomComboBoxes.qml new file mode 100644 index 00000000..bd793e28 --- /dev/null +++ b/tests/manual/nativestyle/CustomComboBoxes.qml @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick.Controls.impl + +ControlContainer { + id: container + title: "ComboBoxes" + + Row { + spacing: container.rowSpacing + + ComboBox { + id: control + model: [ "Custom background", "Banana", "Apple", "Coconut" ] + background: Rectangle { + implicitWidth: 200 + implicitHeight: 20 + color: control.down ? control.palette.mid : control.palette.button + border.color: "green" + border.width: 1 + } + indicator: ColorImage { + x: control.mirrored ? control.padding : control.width - width - control.padding + y: control.topPadding + (control.availableHeight - height) / 2 + color: control.palette.dark + defaultColor: "#353637" + source: "qrc:/qt-project.org/imports/QtQuick/Controls/Default/images/double-arrow.png" + opacity: enabled ? 1 : 0.3 + } + } + + ComboBox { + model: [ "Banana", "Apple", "Coconut" ] + contentItem: Rectangle { + implicitWidth: text.implicitWidth + color: "lightGreen" + Text { + id: text + text: "Custom content item" + anchors.centerIn: parent + } + } + } + + } + + Row { + spacing: container.rowSpacing + + ComboBox { + id: control2 + model: [ "Custom background", "Banana", "Apple", "Coconut" ] + editable: true + background: Rectangle { + implicitWidth: 200 + implicitHeight: 20 + color: control2.down ? control2.palette.mid : control2.palette.button + border.color: "green" + border.width: 1 + } + indicator: ColorImage { + x: control2.mirrored ? control2.padding : control2.width - width - control2.padding + y: control2.topPadding + (control2.availableHeight - height) / 2 + color: control2.palette.dark + defaultColor: "#353637" + source: "qrc:/qt-project.org/imports/QtQuick/Controls/Default/images/double-arrow.png" + opacity: enabled ? 1 : 0.3 + } + } + + ComboBox { + model: [ "Banana", "Apple", "Coconut" ] + editable: true + contentItem: Rectangle { + implicitWidth: text2.implicitWidth + color: "lightGreen" + TextEdit { + id: text2 + text: "Custom content item" + anchors.centerIn: parent + } + } + } + } +} diff --git a/tests/manual/nativestyle/CustomDials.qml b/tests/manual/nativestyle/CustomDials.qml new file mode 100644 index 00000000..cc16e96f --- /dev/null +++ b/tests/manual/nativestyle/CustomDials.qml @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick dial1s 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Controls.Default.impl +import QtQuick.Layouts + +ControlContainer { + id: container + title: "Dials" + + Row { + spacing: container.rowSpacing + + Dial { + id: dial1 + width: 50 + height: 50 + from: 0 + to: 10 + value: 5 + + background: DialImpl { + implicitWidth: 184 + implicitHeight: 184 + color: "darkgray" + progress: dial1.position + opacity: dial1.enabled ? 1 : 0.3 + } + + handle: ColorImage { + x: dial1.background.x + dial1.background.width / 2 - width / 2 + y: dial1.background.y + dial1.background.height / 2 - height / 2 + width: 14 + height: 10 + color: "green" + source: "qrc:/qt-project.org/imports/QtQuick/Controls/Default/images/dial-indicator.png" + antialiasing: true + opacity: dial1.enabled ? 1 : 0.3 + transform: [ + Translate { + y: -Math.min(dial1.background.width, dial1.background.height) * 0.4 + dial1.handle.height / 2 + }, + Rotation { + angle: dial1.angle + origin.x: dial1.handle.width / 2 + origin.y: dial1.handle.height / 2 + } + ] + } + } + } +} diff --git a/tests/manual/nativestyle/CustomFrames.qml b/tests/manual/nativestyle/CustomFrames.qml new file mode 100644 index 00000000..e2b045a5 --- /dev/null +++ b/tests/manual/nativestyle/CustomFrames.qml @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "Frames" + + Row { + spacing: container.rowSpacing + + Frame { + width: 200 + height: 50 + background: Rectangle { + border.width: 1 + border.color: "green" + Text { + anchors.centerIn: parent + color: "green" + text: "Custom background" + } + } + } + } +} diff --git a/tests/manual/nativestyle/CustomProgressBars.qml b/tests/manual/nativestyle/CustomProgressBars.qml new file mode 100644 index 00000000..c920d243 --- /dev/null +++ b/tests/manual/nativestyle/CustomProgressBars.qml @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick.Controls.Default.impl + +ControlContainer { + id: container + title: "ProgressBars" + + property int time: 0 + Timer { + interval: 1000 + running: true + repeat: true + onTriggered: { + time++ + if (time > 10) + time = 0 + } + } + + Row { + spacing: container.rowSpacing + + ProgressBar { + id: c1 + width: 100 + from: 0 + to: 10 + value: time + indeterminate: false + padding: 5 + background: Rectangle { + implicitWidth: 100 + implicitHeight: 6 + color: "darkgray" + } + } + + ProgressBar { + id: c2 + width: 100 + from: 0 + to: 10 + value: time + indeterminate: false + padding: 5 + contentItem: ProgressBarImpl { + implicitHeight: 6 + implicitWidth: 100 + progress: c2.position + indeterminate: false + color: "lightgreen" + } + } + + ProgressBar { + id: c3 + width: 100 + from: 0 + to: 10 + value: time + indeterminate: false + padding: 5 + background: Rectangle { + implicitWidth: 100 + implicitHeight: 6 + color: "darkgray" + } + contentItem: ProgressBarImpl { + implicitHeight: 6 + implicitWidth: 100 + progress: c3.position + indeterminate: false + color: "lightgreen" + } + } + } +} diff --git a/tests/manual/nativestyle/CustomRadioButtons.qml b/tests/manual/nativestyle/CustomRadioButtons.qml new file mode 100644 index 00000000..8a657cdd --- /dev/null +++ b/tests/manual/nativestyle/CustomRadioButtons.qml @@ -0,0 +1,121 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick.Controls.impl + +ControlContainer { + id: container + title: "RadioButtons" + + Row { + spacing: container.rowSpacing + + RadioButton { + id: customContentItem + text: "Custom content item" + contentItem: Text { + text: customContentItem.text + color: "green" + leftPadding: customContentItem.indicator.width + customContentItem.spacing + } + } + + RadioButton { + id: customIndicator + text: "Custom indicator" + indicator: Rectangle { + implicitWidth: 14 + implicitHeight: 14 + + x: customIndicator.text ? customIndicator.leftPadding : customIndicator.leftPadding + (customIndicator.availableWidth - width) / 2 + y: customIndicator.topPadding + (customIndicator.availableHeight - height) / 2 + + radius: width / 2 + color: customIndicator.down ? customIndicator.palette.light : customIndicator.palette.base + border.width: 2 + border.color: "green" + + Rectangle { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: 5 + height: 5 + radius: width / 2 + color: "green" + visible: customIndicator.checked + } + } + } + + RadioButton { + id: allCustom + text: "All custom" + + contentItem: Text { + text: allCustom.text + color: "green" + leftPadding: allCustom.indicator.width + allCustom.spacing + } + + indicator: Rectangle { + implicitWidth: 14 + implicitHeight: 14 + + x: allCustom.text ? allCustom.leftPadding : allCustom.leftPadding + (allCustom.availableWidth - width) / 2 + y: allCustom.topPadding + (allCustom.availableHeight - height) / 2 + + radius: width / 2 + color: allCustom.down ? allCustom.palette.light : allCustom.palette.base + border.width: 2 + border.color: "green" + + Rectangle { + x: (parent.width - width) / 2 + y: (parent.height - height) / 2 + width: 5 + height: 5 + radius: width / 2 + color: "green" + visible: allCustom.checked + } + } + } + } + +} diff --git a/tests/manual/nativestyle/CustomScrollBars.qml b/tests/manual/nativestyle/CustomScrollBars.qml new file mode 100644 index 00000000..07319952 --- /dev/null +++ b/tests/manual/nativestyle/CustomScrollBars.qml @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "ScrollBars" + + Row { + spacing: container.rowSpacing + + ScrollBar { + height: 200 + orientation: Qt.Vertical + size: 0.2 + policy: ScrollBar.AlwaysOn + background: Rectangle { + color: "lightgray" + border.color: "gray" + border.width: 1 + } + } + + ScrollBar { + height: 200 + orientation: Qt.Vertical + size: 0.2 + policy: ScrollBar.AlwaysOn + contentItem: Rectangle { + color: "lightgreen" + border.color: "green" + border.width: 1 + } + } + + ScrollBar { + height: 200 + orientation: Qt.Vertical + size: 0.2 + policy: ScrollBar.AlwaysOn + background: Rectangle { + color: "lightgray" + border.color: "gray" + border.width: 1 + } + contentItem: Rectangle { + implicitWidth: 15 + color: "lightgreen" + border.color: "green" + border.width: 1 + } + } + + Column { + spacing: container.rowSpacing + + ScrollBar { + width: 300 + orientation: Qt.Horizontal + size: 0.2 + policy: ScrollBar.AlwaysOn + background: Rectangle { + color: "lightgray" + border.color: "gray" + border.width: 1 + } + } + + ScrollBar { + width: 300 + orientation: Qt.Horizontal + size: 0.2 + policy: ScrollBar.AlwaysOn + contentItem: Rectangle { + color: "lightgray" + border.color: "gray" + border.width: 1 + } + } + + ScrollBar { + width: 300 + orientation: Qt.Horizontal + size: 0.2 + policy: ScrollBar.AlwaysOn + background: Rectangle { + color: "lightgray" + border.color: "gray" + border.width: 1 + } + contentItem: Rectangle { + implicitHeight: 15 + color: "lightgreen" + border.color: "green" + border.width: 1 + } + } + } + } + +} diff --git a/tests/manual/nativestyle/CustomSliders.qml b/tests/manual/nativestyle/CustomSliders.qml new file mode 100644 index 00000000..075c10d3 --- /dev/null +++ b/tests/manual/nativestyle/CustomSliders.qml @@ -0,0 +1,167 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "Sliders" + property int sliderWidth: 300 + property int sliderHeight: 140 + + Row { + spacing: 40 + + Column { + spacing: 15 + + Slider { + id: customHandle + width: sliderWidth + height: 20 + from: 0 + to: 10 + value: 5 + handle: Rectangle { + id: handle + width: 12 + height: customHandle.height + color: "white" + border.width: 2 + + x: customHandle.visualPosition * (customHandle.availableWidth - width) + y: (customHandle.availableHeight - height) / 2 + } + } + + Slider { + id: customBackground + width: sliderWidth + from: 0 + to: 10 + background: Rectangle { + implicitHeight: 5 + color: "lightgray" + border.width: 1 + } + } + + Slider { + id: customAll + width: sliderWidth + height: 20 + from: 0 + to: 10 + background: Rectangle { + implicitHeight: customAll.height + color: "lightgray" + border.width: 1 + } + handle: Rectangle { + width: 12 + height: customAll.height + color: "white" + border.width: 2 + + x: customAll.visualPosition * (customAll.availableWidth - width) + y: (customAll.availableHeight - height) / 2 + } + } + } + + Row { + spacing: 20 + + Slider { + id: customVHandle + width: 20 + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 10 + value: 5 + handle: Rectangle { + height: 12 + width: customVHandle.width + color: "white" + border.width: 2 + + x: (customVHandle.availableWidth - width) / 2 + y: customVHandle.visualPosition * (customVHandle.availableHeight - height) + } + } + + Slider { + id: customVBackground + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 10 + background: Rectangle { + implicitWidth: 5 + color: "lightgray" + border.width: 1 + } + } + + Slider { + id: customVAll + width: 20 + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 10 + value: 5 + handle: Rectangle { + height: 12 + width: customVHandle.width + color: "white" + border.width: 2 + + x: (customVAll.availableWidth - width) / 2 + y: customVAll.visualPosition * (customVAll.availableHeight - height) + } + background: Rectangle { + implicitWidth: 5 + color: "lightgray" + border.width: 1 + } + } + } + } +} diff --git a/tests/manual/nativestyle/CustomSpinBoxes.qml b/tests/manual/nativestyle/CustomSpinBoxes.qml new file mode 100644 index 00000000..b6de2b57 --- /dev/null +++ b/tests/manual/nativestyle/CustomSpinBoxes.qml @@ -0,0 +1,171 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "SpinBoxes" + + Row { + spacing: container.rowSpacing + + SpinBox { + id: custombg + value: 1000 + to: 2000 + background: Rectangle { + border.color: "green" + implicitWidth: 50 + } + } + + SpinBox { + id: customIndicator + value: 500 + to: 2000 + + rightPadding: 17 + spacing: 0 + implicitWidth: 60 + implicitHeight: 25 + + up.indicator: Rectangle { + x: customIndicator.width - width - 4 + y: 4 + implicitWidth: customIndicator.rightPadding - 4 + implicitHeight: 8 + border.width: 1 + border.color: "green" + color: customIndicator.up.pressed ? "gray" : "transparent" + Text { + text: "+" + font.pixelSize: 8 + font.bold: true + anchors.centerIn: parent + } + } + + down.indicator: Rectangle { + x: customIndicator.width - width - 4 + y: height + 6 + implicitWidth: customIndicator.rightPadding - 4 + implicitHeight: 8 + border.width: 1 + border.color: "green" + color: customIndicator.down.pressed ? "gray" : "transparent" + Text { + text: "-" + font.pixelSize: 10 + font.bold: true + anchors.centerIn: parent + } + } + } + + SpinBox { + id: allCustom + value: 500 + to: 2000 + + rightPadding: 17 + spacing: 0 + implicitWidth: 60 + implicitHeight: 25 + + background: Rectangle { + border.color: "green" + implicitWidth: 50 + } + + up.indicator: Rectangle { + x: allCustom.width - width - 4 + y: 4 + implicitWidth: allCustom.rightPadding - 4 + implicitHeight: 8 + border.width: 1 + border.color: "green" + color: allCustom.up.pressed ? "gray" : "transparent" + Text { + text: "+" + font.pixelSize: 8 + font.bold: true + anchors.centerIn: parent + } + } + + down.indicator: Rectangle { + x: allCustom.width - width - 4 + y: height + 6 + implicitWidth: allCustom.rightPadding - 4 + implicitHeight: 8 + border.width: 1 + border.color: "green" + color: allCustom.down.pressed ? "gray" : "transparent" + Text { + text: "-" + font.pixelSize: 10 + font.bold: true + anchors.centerIn: parent + } + } + + contentItem: TextInput { + text: allCustom.displayText + font: allCustom.font + color: "green" + selectionColor: allCustom.palette.highlight + selectedTextColor: allCustom.palette.highlightedText + horizontalAlignment: Qt.AlignLeft + verticalAlignment: Qt.AlignVCenter + + topPadding: 2 + bottomPadding: 2 + leftPadding: 10 + rightPadding: 10 + + readOnly: !allCustom.editable + validator: allCustom.validator + inputMethodHints: allCustom.inputMethodHints + } + + } + + } + +} diff --git a/tests/manual/nativestyle/CustomTextAreas.qml b/tests/manual/nativestyle/CustomTextAreas.qml new file mode 100644 index 00000000..77e97b0c --- /dev/null +++ b/tests/manual/nativestyle/CustomTextAreas.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "TextFields" + + Row { + spacing: container.rowSpacing + + TextArea { + id: customBackground + width: 200 + wrapMode: TextEdit.WordWrap + text: "Custom background - Lorem ipsum dolor sit amet, consectetur adipiscing elit, " + + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." + background: Rectangle { + implicitWidth: customBackground.contentWidth + implicitHeight: customBackground.contentHeight + border.width: customBackground.activeFocus ? 2 : 1 + color: control.palette.base + border.color: "green" + } + } + + TextArea { + width: 200 + placeholderText: "Large font" + font.pixelSize: 20 + wrapMode: TextEdit.WordWrap + text: "Large font - Lorem ipsum dolor sit amet, consectetur adipiscing elit" + } + } +} diff --git a/tests/manual/nativestyle/CustomTextFields.qml b/tests/manual/nativestyle/CustomTextFields.qml new file mode 100644 index 00000000..3e8ccd1e --- /dev/null +++ b/tests/manual/nativestyle/CustomTextFields.qml @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "TextFields" + + Row { + spacing: container.rowSpacing + + TextField { + placeholderText: "Custom background" + background: Rectangle { + implicitWidth: 130 + implicitHeight: 20 + border.width: control.activeFocus ? 2 : 1 + color: control.palette.base + border.color: "green" + } + } + TextField { + placeholderText: "Large font" + font.pixelSize: 20 + } + } +} diff --git a/tests/manual/nativestyle/Dials.qml b/tests/manual/nativestyle/Dials.qml new file mode 100644 index 00000000..f0655f25 --- /dev/null +++ b/tests/manual/nativestyle/Dials.qml @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "Dials" + + Row { + spacing: container.rowSpacing + + Dial { + width: 50 + height: 50 + from: 0 + to: 10 + value: 5 + } + + Dial { + width: 50 + height: 50 + from: 0 + to: 10 + value: 5 + stepSize: 1 + property int qqc2_style_tickPosition: 1 + } + } +} diff --git a/tests/manual/nativestyle/Frames.qml b/tests/manual/nativestyle/Frames.qml new file mode 100644 index 00000000..220f8d03 --- /dev/null +++ b/tests/manual/nativestyle/Frames.qml @@ -0,0 +1,65 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "Frames" + + Row { + spacing: container.rowSpacing + + Frame { + width: 100 + height: 50 + } + + Frame { + Rectangle { + implicitWidth: label.width + 50 + implicitHeight: 45 + Label { + id: label + anchors.centerIn: parent + text: "Frame with contents" + } + } + } + } +} diff --git a/tests/manual/nativestyle/ProgressBars.qml b/tests/manual/nativestyle/ProgressBars.qml new file mode 100644 index 00000000..8abd076d --- /dev/null +++ b/tests/manual/nativestyle/ProgressBars.qml @@ -0,0 +1,102 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "ProgressBars" + + property int time: 0 + Timer { + interval: 1000 + running: true + repeat: true + onTriggered: { + time++ + if (time > 10) + time = 0 + } + } + + Row { + spacing: container.rowSpacing + + ProgressBar { + width: 100 + from: 0 + to: 10 + value: time + indeterminate: false + } + + ProgressBar { + width: 100 + from: 0 + to: 10 + value: time + enabled: false + indeterminate: false + } + + ProgressBar { + width: 100 + from: 0 + to: 10 + indeterminate: true + } + + ProgressBar { + width: 80 + from: 0 + to: 10 + value: time + indeterminate: false + property bool qqc2_style_small + } + + ProgressBar { + width: 60 + from: 0 + to: 10 + value: time + indeterminate: false + property bool qqc2_style_mini + } + } +} diff --git a/tests/manual/nativestyle/RadioButtons.qml b/tests/manual/nativestyle/RadioButtons.qml new file mode 100644 index 00000000..24a96b59 --- /dev/null +++ b/tests/manual/nativestyle/RadioButtons.qml @@ -0,0 +1,111 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts +import QtQuick.Controls.impl + +ControlContainer { + id: container + title: "RadioButtons" + + Row { + spacing: container.rowSpacing + + Column { + RadioButton { + text: "Default" + checked: true + } + RadioButton { + text: "Default" + } + RadioButton { + text: "Default" + } + } + + Column { + RadioButton { + text: "Disabled" + enabled: false + } + RadioButton { + text: "Disabled" + enabled: false + } + RadioButton { + text: "Disabled" + enabled: false + checked: true + } + } + + Column { + RadioButton { + text: "Small" + property bool qqc2_style_small + } + RadioButton { + text: "Small" + checked: true + property bool qqc2_style_small + } + RadioButton { + text: "Small" + property bool qqc2_style_small + } + } + + Column { + RadioButton { + text: "Mini" + property bool qqc2_style_mini + } + RadioButton { + text: "Mini" + property bool qqc2_style_mini + } + RadioButton { + text: "Mini" + checked: true + property bool qqc2_style_mini + } + } + } + +} diff --git a/tests/manual/nativestyle/ScrollBars.qml b/tests/manual/nativestyle/ScrollBars.qml new file mode 100644 index 00000000..a5764c78 --- /dev/null +++ b/tests/manual/nativestyle/ScrollBars.qml @@ -0,0 +1,99 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "ScrollBars" + + Row { + spacing: container.rowSpacing + + ScrollBar { + height: 200 + orientation: Qt.Vertical + size: 0.2 + policy: ScrollBar.AlwaysOn + } + + ScrollBar { + height: 150 + orientation: Qt.Vertical + size: 0.2 + policy: ScrollBar.AlwaysOn + property bool qqc2_style_small + } + + ScrollBar { + height: 100 + orientation: Qt.Vertical + size: 0.2 + policy: ScrollBar.AlwaysOn + property bool qqc2_style_mini + } + + Column { + spacing: container.rowSpacing + + ScrollBar { + width: 300 + orientation: Qt.Horizontal + size: 0.2 + policy: ScrollBar.AlwaysOn + } + + ScrollBar { + width: 200 + orientation: Qt.Horizontal + size: 0.2 + policy: ScrollBar.AlwaysOn + property bool qqc2_style_small + } + + ScrollBar { + width: 100 + orientation: Qt.Horizontal + size: 0.2 + policy: ScrollBar.AlwaysOn + property bool qqc2_style_mini + } + } + } + +} diff --git a/tests/manual/nativestyle/Sliders.qml b/tests/manual/nativestyle/Sliders.qml new file mode 100644 index 00000000..dcc6c79c --- /dev/null +++ b/tests/manual/nativestyle/Sliders.qml @@ -0,0 +1,132 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "Sliders normal" + property int sliderWidth: 300 + property int sliderHeight: 140 + + Row { + spacing: 40 + + Column { + spacing: 15 + + Slider { + width: sliderWidth + from: 0 + to: 10 + value: 5 + } + + Slider { + width: sliderWidth + from: 0 + to: 10 + value: 5 + enabled: false + } + + Slider { + width: sliderWidth + from: 0 + to: 100 + value: 20 + stepSize: 20 + + property int qqc2_style_tickPosition: 1 + } + + Slider { + width: sliderWidth + from: 0 + to: 100 + stepSize: 5 + value: 65 + + property int qqc2_style_tickPosition: 2 + } + } + + Row { + spacing: 20 + + Slider { + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 10 + value: 5 + } + + Slider { + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 10 + value: 5 + enabled: false + } + + Slider { + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 100 + value: 20 + stepSize: 20 + + property int qqc2_style_tickPosition: 1 + } + + Slider { + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 100 + stepSize: 5 + value: 65 + + property int qqc2_style_tickPosition: 2 + } + } + } +} diff --git a/tests/manual/nativestyle/SlidersMini.qml b/tests/manual/nativestyle/SlidersMini.qml new file mode 100644 index 00000000..4c7610c4 --- /dev/null +++ b/tests/manual/nativestyle/SlidersMini.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "Sliders mini" + property int sliderWidth: 100 + property int sliderHeight: 90 + + Row { + spacing: 40 + + Column { + spacing: 15 + + Slider { + width: sliderWidth + from: 0 + to: 10 + value: 5 + property bool qqc2_style_mini + } + + Slider { + width: sliderWidth + from: 0 + to: 10 + value: 5 + enabled: false + property bool qqc2_style_mini + } + + Slider { + width: sliderWidth + from: 0 + to: 100 + value: 20 + stepSize: 20 + + property bool qqc2_style_mini + property int qqc2_style_tickPosition: 1 + } + + Slider { + width: sliderWidth + from: 0 + to: 100 + stepSize: 5 + value: 65 + + property bool qqc2_style_mini + property int qqc2_style_tickPosition: 2 + } + } + + Row { + spacing: 20 + + Slider { + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 10 + value: 5 + property bool qqc2_style_mini + } + + Slider { + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 10 + value: 5 + enabled: false + property bool qqc2_style_mini + } + + Slider { + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 100 + value: 20 + stepSize: 20 + + property bool qqc2_style_mini + property int qqc2_style_tickPosition: 1 + } + + Slider { + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 100 + stepSize: 5 + value: 65 + + property bool qqc2_style_mini + property int qqc2_style_tickPosition: 2 + } + } + } +} diff --git a/tests/manual/nativestyle/SlidersSmall.qml b/tests/manual/nativestyle/SlidersSmall.qml new file mode 100644 index 00000000..04c9cb24 --- /dev/null +++ b/tests/manual/nativestyle/SlidersSmall.qml @@ -0,0 +1,140 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "Sliders small" + property int sliderWidth: 200 + property int sliderHeight: 100 + + Row { + spacing: 40 + + Column { + spacing: 15 + + Slider { + width: sliderWidth + from: 0 + to: 10 + value: 5 + property bool qqc2_style_small + } + + Slider { + width: sliderWidth + from: 0 + to: 10 + value: 5 + enabled: false + property bool qqc2_style_small + } + + Slider { + width: sliderWidth + from: 0 + to: 100 + value: 20 + stepSize: 20 + + property bool qqc2_style_small + property int qqc2_style_tickPosition: 1 + } + + Slider { + width: sliderWidth + from: 0 + to: 100 + stepSize: 5 + value: 65 + + property bool qqc2_style_small + property int qqc2_style_tickPosition: 2 + } + } + + Row { + spacing: 20 + + Slider { + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 10 + value: 5 + property bool qqc2_style_small + } + + Slider { + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 10 + value: 5 + enabled: false + property bool qqc2_style_small + } + + Slider { + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 100 + value: 20 + stepSize: 20 + + property bool qqc2_style_small + property int qqc2_style_tickPosition: 1 + } + + Slider { + height: sliderHeight + orientation: Qt.Vertical + from: 0 + to: 100 + stepSize: 5 + value: 65 + + property bool qqc2_style_small + property int qqc2_style_tickPosition: 2 + } + } + } +} diff --git a/tests/manual/nativestyle/SpinBoxes.qml b/tests/manual/nativestyle/SpinBoxes.qml new file mode 100644 index 00000000..60e2213b --- /dev/null +++ b/tests/manual/nativestyle/SpinBoxes.qml @@ -0,0 +1,73 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "SpinBoxes" + + Row { + spacing: container.rowSpacing + + SpinBox { + value: 500 + to: 2000 + } + + SpinBox { + value: 0 + enabled: false + } + + SpinBox { + value: 5 + from: 0 + to: 9 + property bool qqc2_style_small + } + + SpinBox { + value: 0 + from: -9 + to: 9 + property bool qqc2_style_mini + } + } + +} diff --git a/tests/manual/nativestyle/TextAreas.qml b/tests/manual/nativestyle/TextAreas.qml new file mode 100644 index 00000000..0e1573b0 --- /dev/null +++ b/tests/manual/nativestyle/TextAreas.qml @@ -0,0 +1,130 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "TextAreas" + + Row { + spacing: container.rowSpacing + + TextArea { + id: defaultTextArea + width: 200 + wrapMode: TextEdit.WordWrap + selectByMouse: true + text: "Default - Lorem ipsum dolor sit amet, consectetur adipiscing elit, " + + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." + } + + TextArea { + enabled: false + width: 200 + wrapMode: TextEdit.WordWrap + selectByMouse: true + text: "Disabled - Lorem ipsum dolor sit amet, consectetur adipiscing elit, " + + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." + } + + ScrollView { + id: scrollView + width: 200 + height: defaultTextArea.height + ScrollBar.vertical.policy: ScrollBar.AlwaysOn + + TextArea { + text: "Inside ScrollView - Lorem ipsum dolor sit amet, consectetur adipiscing elit, " + + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " + + "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi " + + "ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit " + + "in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur " + + "sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt " + + "mollit anim id est laborum." + wrapMode: TextEdit.WordWrap + selectByMouse: true + rightPadding: scrollView.ScrollBar.vertical.width + } + } + } + + Row { + spacing: container.rowSpacing + + Frame { + TextArea { + id: area1 + width: 200 + wrapMode: TextEdit.WrapAnywhere + selectByMouse: true + text: "Inside frame - Lorem ipsum dolor sit amet, consectetur adipiscing elit, " + + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua." + } + } + + Frame { + contentWidth: 200 + contentHeight: 100 + ScrollView { + id: scrollView2 + anchors.fill: parent + ScrollBar.vertical.policy: ScrollBar.AlwaysOn + + TextArea { + id: area2 + text: "Inside Frame and ScrollView - Lorem ipsum dolor sit amet, consectetur adipiscing elit, " + + "sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. " + + "Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi " + + "ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit " + + "in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur " + + "sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt " + + "mollit anim id est laborum." + wrapMode: TextEdit.WordWrap + selectByMouse: true + rightPadding: scrollView2.ScrollBar.vertical.width + } + } + } + + TextArea { + placeholderText: "Placeholder text" + selectByMouse: true + } + } +} diff --git a/tests/manual/nativestyle/TextFields.qml b/tests/manual/nativestyle/TextFields.qml new file mode 100644 index 00000000..10e97da5 --- /dev/null +++ b/tests/manual/nativestyle/TextFields.qml @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Controls +import QtQuick.Layouts + +ControlContainer { + id: container + title: "TextFields" + + Row { + spacing: container.rowSpacing + + TextField { + text: "Default" + } + + TextField { + enabled: false + text: "Disabled" + } + + TextField { + placeholderText: "Placeholder text" + } + + TextField { + text: "Small" + property bool qqc2_style_small + } + + TextField { + text: "Mini" + property bool qqc2_style_mini + } + } +} diff --git a/tests/manual/nativestyle/checkbox-icon.png b/tests/manual/nativestyle/checkbox-icon.png Binary files differnew file mode 100644 index 00000000..ee669b3a --- /dev/null +++ b/tests/manual/nativestyle/checkbox-icon.png diff --git a/tests/manual/nativestyle/checkbox-icon16.png b/tests/manual/nativestyle/checkbox-icon16.png Binary files differnew file mode 100644 index 00000000..8d89eab8 --- /dev/null +++ b/tests/manual/nativestyle/checkbox-icon16.png diff --git a/tests/manual/nativestyle/checkbox-icon@2x.png b/tests/manual/nativestyle/checkbox-icon@2x.png Binary files differnew file mode 100644 index 00000000..51c5601d --- /dev/null +++ b/tests/manual/nativestyle/checkbox-icon@2x.png diff --git a/tests/manual/nativestyle/main.cpp b/tests/manual/nativestyle/main.cpp new file mode 100644 index 00000000..aee43242 --- /dev/null +++ b/tests/manual/nativestyle/main.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QGuiApplication> +#include <QQmlApplicationEngine> +#include <QtQuickControls2/qquickstyle.h> + +int main(int argc, char *argv[]) +{ + QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling); + QGuiApplication app(argc, argv); + + // Todo: rename the "default" style to e.g "simple" + // and use "default" as a phony style name instad + // to mean "get me the default style on the current + // platform". + const QString style = qEnvironmentVariable("DESKTOPGALLERY_STYLE"); + if (!style.isEmpty()) + QQuickStyle::setStyle(style); + else +#if defined(Q_OS_MACOS) + QQuickStyle::setStyle("macOS"); +#elif defined(Q_OS_WINDOWS) + QQuickStyle::setStyle("Windows"); +#else + QQuickStyle::setStyle("FusionDesktop"); +#endif + + QQmlApplicationEngine engine; + const QUrl url(QStringLiteral("qrc:/main.qml")); + QObject::connect(&engine, &QQmlApplicationEngine::objectCreated, + &app, [url](QObject *obj, const QUrl &objUrl) { + if (!obj && url == objUrl) + QCoreApplication::exit(-1); + }, Qt::QueuedConnection); + engine.load(url); + + return app.exec(); +} diff --git a/tests/manual/nativestyle/main.qml b/tests/manual/nativestyle/main.qml new file mode 100644 index 00000000..f0575820 --- /dev/null +++ b/tests/manual/nativestyle/main.qml @@ -0,0 +1,125 @@ +/**************************************************************************** +** +** Copyright (C) 2020 The Qt Company Ltd. +** Contact: http://www.qt.io/licensing/ +** +** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL3$ +** 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 http://www.qt.io/terms-conditions. For further +** information use the contact form at http://www.qt.io/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 3 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPLv3 included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 3 requirements +** will be met: https://www.gnu.org/licenses/lgpl.html. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 2.0 or later as published by the Free +** Software Foundation and appearing in the file LICENSE.GPL included in +** the packaging of this file. Please review the following information to +** ensure the GNU General Public License version 2.0 requirements will be +** met: http://www.gnu.org/licenses/gpl-2.0.html. +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick +import QtQuick.Window +import QtQuick.Controls +import QtQuick.Layouts + +ApplicationWindow { + visible: true + width: 800 + height: 600 + title: qsTr("Desktop Gallery") + + TabBar { + id: bar + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 20 + anchors.rightMargin: 40 + + TabButton { + text: qsTr("Default controls") + } + + TabButton { + text: qsTr("Customized controls") + } + } + + StackLayout { + currentIndex: bar.currentIndex + anchors.top: bar.bottom + anchors.bottom: parent.bottom + anchors.left: parent.left + anchors.right: parent.right + anchors.margins: 20 + + ScrollView { + contentWidth: width + clip: true + ScrollBar.vertical.policy: ScrollBar.AlwaysOn + + Column { + anchors.left: parent.left + anchors.right: parent.right + spacing: 20 + + Buttons { } + CheckBoxes { } + RadioButtons { } + SpinBoxes { } + TextFields { } + TextAreas { } + ComboBoxes { } + Dials { } + Frames { } + ProgressBars { } + ScrollBars { } + Sliders { } + SlidersSmall { } + SlidersMini { } + } + } + + ScrollView { + contentWidth: width + clip: true + ScrollBar.vertical.policy: ScrollBar.AlwaysOn + + Column { + anchors.left: parent.left + anchors.right: parent.right + spacing: 20 + + CustomButtons { } + CustomCheckBoxes { } + CustomRadioButtons { } + CustomSpinBoxes { } + CustomTextFields { } + CustomTextAreas { } + CustomComboBoxes { } + CustomDials { } + CustomFrames { } + CustomProgressBars { } + CustomScrollBars { } + CustomSliders { } + } + } + } + +} diff --git a/tests/manual/nativestyle/nativestyle.pro b/tests/manual/nativestyle/nativestyle.pro new file mode 100644 index 00000000..9c700430 --- /dev/null +++ b/tests/manual/nativestyle/nativestyle.pro @@ -0,0 +1,39 @@ +QT += quick quickcontrols2 + +SOURCES += \ + main.cpp + +QML_FILES = \ + main.qml \ + ControlContainer.qml \ + Buttons.qml \ + CustomButtons.qml \ + Sliders.qml \ + SlidersSmall.qml \ + SlidersMini.qml \ + CustomSliders.qml \ + CheckBoxes.qml \ + CustomCheckBoxes.qml \ + RadioButtons.qml \ + CustomRadioButtons.qml \ + SpinBoxes.qml \ + CustomSpinBoxes.qml \ + TextFields.qml \ + CustomTextFields.qml \ + Frames.qml \ + CustomFrames.qml \ + TextAreas.qml \ + CustomTextAreas.qml \ + ComboBoxes.qml \ + CustomComboBoxes.qml \ + ScrollBars.qml \ + CustomScrollBars.qml \ + ProgressBars.qml \ + CustomProgressBars.qml \ + Dials.qml \ + CustomDials.qml \ + +OTHER_FILES += $$QML_FILES +RESOURCES += $$QML_FILES +RESOURCES += checkbox-icon.png checkbox-icon16.png checkbox-icon@2x.png + diff --git a/tests/manual/nativestyle/qml.qrc b/tests/manual/nativestyle/qml.qrc new file mode 100644 index 00000000..fba642e5 --- /dev/null +++ b/tests/manual/nativestyle/qml.qrc @@ -0,0 +1,7 @@ +<RCC> + <qresource prefix="/"> + <file>main.qml</file> + <file>ButtonsTab.qml</file> + <file>SlidersTab.qml</file> + </qresource> +</RCC> |