From 46215a8bcc4423fe79be4e4830435a1e10db22e7 Mon Sep 17 00:00:00 2001 From: J-P Nurmi Date: Fri, 25 Sep 2015 19:28:36 +0200 Subject: Remove ToggleButton We don't have a sensible design. It's better not to have it at all than to have a confusing tiny bit tweaked clone of Switch. Change-Id: Ib0eabd075590100e9e49846c7172909525b54a57 Reviewed-by: Liang Qi --- examples/quick/controls/mirroring/main.qml | 6 +- src/imports/controls/ToggleButton.qml | 106 --------- src/imports/controls/controls.pri | 1 - .../controls/designer/ToggleButtonSpecifics.qml | 81 ------- src/imports/controls/designer/designer.pri | 1 - .../controls/designer/qtquickcontrols2.metainfo | 15 -- .../doc/src/qtquickcontrols2-customize.qdoc | 26 +-- src/imports/controls/qtquickcontrols2plugin.cpp | 1 - src/imports/templates/qtquicktemplates2plugin.cpp | 2 - src/templates/qquicktogglebutton.cpp | 84 ------- src/templates/qquicktogglebutton_p.h | 67 ------ src/templates/templates.pri | 2 - tests/auto/accessibility/data/togglebutton.qml | 13 -- tests/auto/accessibility/tst_accessibility.cpp | 1 - .../activeFocusOnTab/data/activeFocusOnTab.qml | 5 - .../auto/activeFocusOnTab/tst_activeFocusOnTab.cpp | 22 +- tests/auto/controls/data/tst_exclusivegroup.qml | 11 - tests/auto/controls/data/tst_togglebutton.qml | 259 --------------------- .../qtquickcontrols2-togglebutton-background.qml | 10 - .../qtquickcontrols2-togglebutton-checked.qml | 7 - .../qtquickcontrols2-togglebutton-disabled.qml | 7 - .../qtquickcontrols2-togglebutton-focused.qml | 7 - .../qtquickcontrols2-togglebutton-indicator.qml | 11 - .../qtquickcontrols2-togglebutton-label.qml | 11 - .../qtquickcontrols2-togglebutton-normal.qml | 6 - tests/benchmarks/objectcount/tst_objectcount.cpp | 4 - tests/manual/fonts/main.qml | 1 - 27 files changed, 6 insertions(+), 761 deletions(-) delete mode 100644 src/imports/controls/ToggleButton.qml delete mode 100644 src/imports/controls/designer/ToggleButtonSpecifics.qml delete mode 100644 src/templates/qquicktogglebutton.cpp delete mode 100644 src/templates/qquicktogglebutton_p.h delete mode 100644 tests/auto/accessibility/data/togglebutton.qml delete mode 100644 tests/auto/controls/data/tst_togglebutton.qml delete mode 100644 tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-background.qml delete mode 100644 tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-checked.qml delete mode 100644 tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-disabled.qml delete mode 100644 tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-focused.qml delete mode 100644 tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-indicator.qml delete mode 100644 tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-label.qml delete mode 100644 tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-normal.qml diff --git a/examples/quick/controls/mirroring/main.qml b/examples/quick/controls/mirroring/main.qml index 85a19425..6f834b34 100644 --- a/examples/quick/controls/mirroring/main.qml +++ b/examples/quick/controls/mirroring/main.qml @@ -59,7 +59,7 @@ ApplicationWindow { headerPositioning: ListView.PullBackHeader header: Rectangle { - property alias mirror: mirrorToggle.checked + property alias mirror: mirrorSwitch.checked z: 2 width: parent.width @@ -77,8 +77,8 @@ ApplicationWindow { font.pointSize: 26 } - ToggleButton { - id: mirrorToggle + Switch { + id: mirrorSwitch text: "Mirror" anchors.right: parent.right anchors.bottom: parent.bottom diff --git a/src/imports/controls/ToggleButton.qml b/src/imports/controls/ToggleButton.qml deleted file mode 100644 index e5dd2805..00000000 --- a/src/imports/controls/ToggleButton.qml +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Quick Controls 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 2.6 -import QtQuick.Controls 2.0 -import QtQuick.Templates 2.0 as T - -T.ToggleButton { - id: control - - implicitWidth: Math.max(background ? background.implicitWidth : 0, - (label ? label.implicitWidth : 0) + - (indicator ? indicator.implicitWidth : 0) + - (label && indicator ? spacing : 0) + leftPadding + rightPadding) - implicitHeight: Math.max(background ? background.implicitHeight : 0, - Math.max(label ? label.implicitHeight : 0, - indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding) - - padding: 6 - spacing: 6 - - //! [indicator] - indicator: Rectangle { - implicitWidth: 36 - implicitHeight: 20 - x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2 - y: control.topPadding + (control.availableHeight - height) / 2 - - radius: 3 - border.width: control.activeFocus ? 2 : 1 - border.color: control.activeFocus ? control.Theme.focusColor : control.Theme.frameColor - color: control.Theme.backgroundColor - - Rectangle { - width: 12 - height: 12 - - color: Qt.tint(control.checked && !control.enabled ? control.Theme.disabledColor : - control.checked && control.activeFocus ? control.Theme.focusColor : - control.checked ? control.Theme.accentColor : control.Theme.baseColor, - control.pressed ? control.Theme.pressColor : "transparent") - border.width: control.checked || control.pressed ? 0 : 1 - border.color: control.Theme.frameColor - - x: Math.max(4, Math.min(parent.width - width - 4, - control.visualPosition * parent.width - (width / 2))) - y: (parent.height - height) / 2 - - Behavior on x { - enabled: !control.pressed - SmoothedAnimation { velocity: 200 } - } - } - } - //! [indicator] - - //! [label] - label: Text { - x: control.mirrored ? control.leftPadding : (indicator.x + indicator.width + control.spacing) - y: control.topPadding - width: control.availableWidth - indicator.width - control.spacing - height: control.availableHeight - - text: control.text - font: control.font - color: control.enabled ? control.Theme.textColor : control.Theme.disabledColor - elide: Text.ElideRight - visible: control.text - horizontalAlignment: Text.AlignLeft - verticalAlignment: Text.AlignVCenter - } - //! [label] -} diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri index ed62ee45..ee9c2e63 100644 --- a/src/imports/controls/controls.pri +++ b/src/imports/controls/controls.pri @@ -21,7 +21,6 @@ QML_FILES = \ TabButton.qml \ TextArea.qml \ TextField.qml \ - ToggleButton.qml \ ToolBar.qml \ ToolButton.qml \ Tumbler.qml diff --git a/src/imports/controls/designer/ToggleButtonSpecifics.qml b/src/imports/controls/designer/ToggleButtonSpecifics.qml deleted file mode 100644 index c23c9cb9..00000000 --- a/src/imports/controls/designer/ToggleButtonSpecifics.qml +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Quick Controls 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 2.1 -import HelperWidgets 2.0 -import QtQuick.Layouts 1.0 - -Column { - width: parent.width - - Section { - width: parent.width - caption: qsTr("Toggle Button") - - SectionLayout { - Label { - text: qsTr("Text") - tooltip: qsTr("The text displayed on the toggle button.") - } - SecondColumnLayout { - LineEdit { - backendValue: backendValues.text - Layout.fillWidth: true - } - } - - Label { - text: qsTr("Checked") - tooltip: qsTr("The checked state of the toggle button.") - } - SecondColumnLayout { - CheckBox { - text: backendValues.checked.valueToString - backendValue: backendValues.checked - Layout.fillWidth: true - } - } - } - } - - ControlSection { - width: parent.width - } - - PaddingSection { - width: parent.width - } -} diff --git a/src/imports/controls/designer/designer.pri b/src/imports/controls/designer/designer.pri index 69202e83..8a14bc69 100644 --- a/src/imports/controls/designer/designer.pri +++ b/src/imports/controls/designer/designer.pri @@ -18,7 +18,6 @@ QML_FILES += \ $$PWD/SwitchSpecifics.qml \ $$PWD/TextAreaSpecifics.qml \ $$PWD/TextFieldSpecifics.qml \ - $$PWD/ToggleButtonSpecifics.qml \ $$PWD/ToolBarSpecifics.qml \ $$PWD/ToolButtonSpecifics.qml diff --git a/src/imports/controls/designer/qtquickcontrols2.metainfo b/src/imports/controls/designer/qtquickcontrols2.metainfo index d00b541f..40439833 100644 --- a/src/imports/controls/designer/qtquickcontrols2.metainfo +++ b/src/imports/controls/designer/qtquickcontrols2.metainfo @@ -195,21 +195,6 @@ MetaInfo { } } - Type { - name: "QtQuick.Controls.ToggleButton" - icon: "images/todo16.png" - - ItemLibraryEntry { - name: "Toggle Button" - category: "Qt Quick - Controls" - libraryIcon: "images/todo.png" - version: "2.0" - requiredImport: "QtQuick.Controls" - - Property { name: "text"; type: "binding"; value: "qsTr('Toggle Button')" } - } - } - Type { name: "QtQuick.Controls.ToolButton" icon: "images/todo16.png" diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc index e554b202..7b4176f5 100644 --- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc +++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc @@ -329,30 +329,6 @@ \snippet TextField.qml placeholder - \section1 Customizing ToggleButton - - ToggleButton consists of three visual items: \l {Control::background}{background}, - \l {AbstractButton::label}{label} and \l {Checkable::indicator}{indicator}. - - \section3 Background - - \image qtquickcontrols2-togglebutton-background.png - - ToggleButton has no background item by default. - - \section3 Label - - \image qtquickcontrols2-togglebutton-label.png - - \snippet ToggleButton.qml label - - \section3 Indicator - - \image qtquickcontrols2-togglebutton-indicator.png - - \snippet ToggleButton.qml indicator - - \section1 Customizing ToolBar ToolBar consists of two visual items: \l {Control::background}{background} and @@ -368,7 +344,7 @@ \image qtquickcontrols2-toolbar-frame.png - ToggleButton has no frame item by default. + ToolBar has no frame item by default. \section1 Customizing ToolButton diff --git a/src/imports/controls/qtquickcontrols2plugin.cpp b/src/imports/controls/qtquickcontrols2plugin.cpp index 1d9467bc..d12f164b 100644 --- a/src/imports/controls/qtquickcontrols2plugin.cpp +++ b/src/imports/controls/qtquickcontrols2plugin.cpp @@ -91,7 +91,6 @@ void QtQuickControls2Plugin::registerTypes(const char *uri) qmlRegisterType(selector.select(QUrl(base + QStringLiteral("/TabButton.qml"))), uri, 2, 0, "TabButton"); qmlRegisterType(selector.select(QUrl(base + QStringLiteral("/TextArea.qml"))), uri, 2, 0, "TextArea"); qmlRegisterType(selector.select(QUrl(base + QStringLiteral("/TextField.qml"))), uri, 2, 0, "TextField"); - qmlRegisterType(selector.select(QUrl(base + QStringLiteral("/ToggleButton.qml"))), uri, 2, 0, "ToggleButton"); qmlRegisterType(selector.select(QUrl(base + QStringLiteral("/ToolBar.qml"))), uri, 2, 0, "ToolBar"); qmlRegisterType(selector.select(QUrl(base + QStringLiteral("/ToolButton.qml"))), uri, 2, 0, "ToolButton"); qmlRegisterType(selector.select(QUrl(base + QStringLiteral("/Tumbler.qml"))), uri, 2, 0, "Tumbler"); diff --git a/src/imports/templates/qtquicktemplates2plugin.cpp b/src/imports/templates/qtquicktemplates2plugin.cpp index 6ce40e99..7d25d3db 100644 --- a/src/imports/templates/qtquicktemplates2plugin.cpp +++ b/src/imports/templates/qtquicktemplates2plugin.cpp @@ -60,7 +60,6 @@ #include #include #include -#include #include #include #include @@ -103,7 +102,6 @@ void QtQuickTemplates2Plugin::registerTypes(const char *uri) qmlRegisterType(uri, 2, 0, "TabButton"); qmlRegisterType(uri, 2, 0, "TextArea"); qmlRegisterType(uri, 2, 0, "TextField"); - qmlRegisterType(uri, 2, 0, "ToggleButton"); qmlRegisterType(uri, 2, 0, "ToolBar"); qmlRegisterType(uri, 2, 0, "ToolButton"); qmlRegisterType(); diff --git a/src/templates/qquicktogglebutton.cpp b/src/templates/qquicktogglebutton.cpp deleted file mode 100644 index 96edbefd..00000000 --- a/src/templates/qquicktogglebutton.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Quick Controls 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 "qquicktogglebutton_p.h" - -QT_BEGIN_NAMESPACE - -/*! - \qmltype ToggleButton - \inherits Checkable - \instantiates QQuickToggleButton - \inqmlmodule QtQuick.Controls - \ingroup buttons - \brief A toggle button control. - - ToggleButton is an option button that can be dragged or toggled on - (checked) or off (unchecked). ToggleButtons are typically used to - select between two states. - - \table - \row \li \image qtquickcontrols2-togglebutton-normal.png - \li A toggle button in its normal state. - \row \li \image qtquickcontrols2-togglebutton-checked.png - \li A toggle button that is checked. - \row \li \image qtquickcontrols2-togglebutton-focused.png - \li A toggle button that has active focus. - \row \li \image qtquickcontrols2-togglebutton-disabled.png - \li A toggle button that is disabled. - \endtable - - \code - ColumnLayout { - ToggleButton { - text: qsTr("Wi-Fi") - } - ToggleButton { - text: qsTr("Bluetooth") - } - } - \endcode - - \sa {Customizing ToggleButton} -*/ - -QQuickToggleButton::QQuickToggleButton(QQuickItem *parent) : - QQuickSwitch(parent) -{ - setAccessibleRole(0x0000002B); //QAccessible::Button -} - -QT_END_NAMESPACE diff --git a/src/templates/qquicktogglebutton_p.h b/src/templates/qquicktogglebutton_p.h deleted file mode 100644 index 8f80437e..00000000 --- a/src/templates/qquicktogglebutton_p.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the Qt Quick Controls 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$ -** -****************************************************************************/ - -#ifndef QQUICKTOGGLEBUTTON_P_H -#define QQUICKTOGGLEBUTTON_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include - -QT_BEGIN_NAMESPACE - -class Q_QUICKTEMPLATES_EXPORT QQuickToggleButton : public QQuickSwitch -{ - Q_OBJECT - -public: - explicit QQuickToggleButton(QQuickItem *parent = Q_NULLPTR); -}; - -Q_DECLARE_TYPEINFO(QQuickToggleButton, Q_COMPLEX_TYPE); - -QT_END_NAMESPACE - -#endif // QQUICKTOGGLEBUTTON_P_H diff --git a/src/templates/templates.pri b/src/templates/templates.pri index 3c3cd3d9..572fa69c 100644 --- a/src/templates/templates.pri +++ b/src/templates/templates.pri @@ -38,7 +38,6 @@ HEADERS += \ $$PWD/qquicktextarea_p_p.h \ $$PWD/qquicktextfield_p.h \ $$PWD/qquicktextfield_p_p.h \ - $$PWD/qquicktogglebutton_p.h \ $$PWD/qquicktoolbar_p.h \ $$PWD/qquicktoolbutton_p.h \ $$PWD/qquicktumbler_p.h @@ -73,7 +72,6 @@ SOURCES += \ $$PWD/qquicktabbutton.cpp \ $$PWD/qquicktextarea.cpp \ $$PWD/qquicktextfield.cpp \ - $$PWD/qquicktogglebutton.cpp \ $$PWD/qquicktoolbar.cpp \ $$PWD/qquicktoolbutton.cpp \ $$PWD/qquicktumbler.cpp diff --git a/tests/auto/accessibility/data/togglebutton.qml b/tests/auto/accessibility/data/togglebutton.qml deleted file mode 100644 index 8f75c364..00000000 --- a/tests/auto/accessibility/data/togglebutton.qml +++ /dev/null @@ -1,13 +0,0 @@ -import QtQuick 2.5 -import QtQuick.Window 2.2 -import QtQuick.Controls 2.0 - -Window { - visible: true - - ToggleButton { - id: togglebutton - objectName: "togglebutton" - text: "ToggleButton" - } -} diff --git a/tests/auto/accessibility/tst_accessibility.cpp b/tests/auto/accessibility/tst_accessibility.cpp index 41a0ed4b..450fb88a 100644 --- a/tests/auto/accessibility/tst_accessibility.cpp +++ b/tests/auto/accessibility/tst_accessibility.cpp @@ -87,7 +87,6 @@ void tst_accessibility::a11y_data() QTest::newRow("TabButton") << "tabbutton" << 0x00000025 << "TabButton"; //QAccessible::PageTab QTest::newRow("TextArea") << "textarea" << 0x0000002A << "TextArea"; //QAccessible::Accessible.EditableText QTest::newRow("TextField") << "textfield" << 0x0000002A << "TextField"; //QAccessible::Accessible.EditableText - QTest::newRow("ToggleButton") << "togglebutton" << 0x0000002B << "ToggleButton"; //QAccessible::Button QTest::newRow("ToolBar") << "toolbar" << 0x00000016 << ""; //QAccessible::ToolBar QTest::newRow("ToolButton") << "toolbutton" << 0x0000002B << "ToolButton"; //QAccessible::Button diff --git a/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml b/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml index 92a90127..dd2281dd 100644 --- a/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml +++ b/tests/auto/activeFocusOnTab/data/activeFocusOnTab.qml @@ -163,11 +163,6 @@ Item { objectName: "textfield" text: "abc" } - ToggleButton { - id: togglebutton - objectName: "togglebutton" - text: "togglebutton" - } ToolBar { width: parent.width id: toolbar diff --git a/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp b/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp index 8ac756b9..b0fbf597 100644 --- a/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp +++ b/tests/auto/activeFocusOnTab/tst_activeFocusOnTab.cpp @@ -207,16 +207,7 @@ void tst_activeFocusOnTab::activeFocusOnTab() QVERIFY(item); QVERIFY(item->hasActiveFocus()); - // Tab: textfield->togglebutton - key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); - QGuiApplication::sendEvent(window, &key); - QVERIFY(key.isAccepted()); - - item = findItem(window->rootObject(), "togglebutton"); - QVERIFY(item); - QVERIFY(item->hasActiveFocus()); - - // Tab: togglebutton->toolbutton + // Tab: textfield->toolbutton key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::NoModifier, "", false, 1); QGuiApplication::sendEvent(window, &key); QVERIFY(key.isAccepted()); @@ -243,16 +234,7 @@ void tst_activeFocusOnTab::activeFocusOnTab() QVERIFY(item); QVERIFY(item->hasActiveFocus()); - // BackTab: toolbutton->togglebutton - key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1); - QGuiApplication::sendEvent(window, &key); - QVERIFY(key.isAccepted()); - - item = findItem(window->rootObject(), "togglebutton"); - QVERIFY(item); - QVERIFY(item->hasActiveFocus()); - - // BackTab: togglebutton->textfield + // BackTab: toolbutton->textfield key = QKeyEvent(QEvent::KeyPress, Qt::Key_Tab, Qt::ShiftModifier, "", false, 1); QGuiApplication::sendEvent(window, &key); QVERIFY(key.isAccepted()); diff --git a/tests/auto/controls/data/tst_exclusivegroup.qml b/tests/auto/controls/data/tst_exclusivegroup.qml index 41794ab2..61076ec8 100644 --- a/tests/auto/controls/data/tst_exclusivegroup.qml +++ b/tests/auto/controls/data/tst_exclusivegroup.qml @@ -256,16 +256,6 @@ TestCase { } } - Component { - id: toggleButtons - Item { - property ExclusiveGroup group: ExclusiveGroup { id: group } - property ToggleButton control1: ToggleButton { ExclusiveGroup.group: group } - property ToggleButton control2: ToggleButton { ExclusiveGroup.group: group } - property ToggleButton control3: ToggleButton { ExclusiveGroup.group: group } - } - } - Component { id: childControls Item { @@ -285,7 +275,6 @@ TestCase { { tag: "CheckBox", component: checkBoxes }, { tag: "RadioButton", component: radioButtons }, { tag: "Switch", component: switches }, - { tag: "ToggleButton", component: toggleButtons }, { tag: "Children", component: childControls } ] } diff --git a/tests/auto/controls/data/tst_togglebutton.qml b/tests/auto/controls/data/tst_togglebutton.qml deleted file mode 100644 index 416be713..00000000 --- a/tests/auto/controls/data/tst_togglebutton.qml +++ /dev/null @@ -1,259 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2015 The Qt Company Ltd. -** Contact: http://www.qt.io/licensing/ -** -** This file is part of the test suite of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:BSD$ -** You may use this file under the terms of the BSD license as follows: -** -** "Redistribution and use in source and binary forms, with or without -** modification, are permitted provided that the following conditions are -** met: -** * Redistributions of source code must retain the above copyright -** notice, this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright -** notice, this list of conditions and the following disclaimer in -** the documentation and/or other materials provided with the -** distribution. -** * Neither the name of The Qt Company Ltd nor the names of its -** contributors may be used to endorse or promote products derived -** from this software without specific prior written permission. -** -** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.2 -import QtTest 1.0 -import QtQuick.Controls 2.0 - -TestCase { - id: testCase - width: 200 - height: 200 - visible: true - when: windowShown - name: "ToggleButton" - - SignalSpy { - id: checkedSpy - signalName: "checkedChanged" - } - - SignalSpy { - id: pressedSpy - signalName: "pressedChanged" - } - - SignalSpy { - id: clickedSpy - signalName: "clicked" - } - - Component { - id: toggleButton - ToggleButton { } - } - - function init() { - verify(!checkedSpy.target) - verify(!pressedSpy.target) - verify(!clickedSpy.target) - compare(checkedSpy.count, 0) - compare(pressedSpy.count, 0) - compare(clickedSpy.count, 0) - } - - function cleanup() { - checkedSpy.target = null - pressedSpy.target = null - clickedSpy.target = null - checkedSpy.clear() - pressedSpy.clear() - clickedSpy.clear() - } - - function test_text() { - var control = toggleButton.createObject(testCase) - verify(control) - - compare(control.text, "") - control.text = "ToggleButton" - compare(control.text, "ToggleButton") - control.text = "" - compare(control.text, "") - - control.destroy() - } - - function test_checked() { - var control = toggleButton.createObject(testCase) - verify(control) - - checkedSpy.target = control - verify(checkedSpy.valid) - - compare(control.checked, false) - compare(checkedSpy.count, 0) - - control.checked = true - compare(control.checked, true) - compare(checkedSpy.count, 1) - - control.checked = false - compare(control.checked, false) - compare(checkedSpy.count, 2) - - control.destroy() - } - - function test_mouse() { - var control = toggleButton.createObject(testCase) - verify(control) - - checkedSpy.target = control - pressedSpy.target = control - clickedSpy.target = control - verify(checkedSpy.valid) - verify(pressedSpy.valid) - verify(clickedSpy.valid) - - // check - mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton) - compare(pressedSpy.count, 1) - compare(control.pressed, true) - mouseRelease(control, control.width / 2, control.height / 2, Qt.LeftButton) - compare(clickedSpy.count, 1) - compare(checkedSpy.count, 1) - compare(pressedSpy.count, 2) - compare(control.checked, true) - compare(control.pressed, false) - - // uncheck - mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton) - compare(pressedSpy.count, 3) - compare(control.pressed, true) - mouseRelease(control, control.width / 2, control.height / 2, Qt.LeftButton) - compare(clickedSpy.count, 2) - compare(checkedSpy.count, 2) - compare(pressedSpy.count, 4) - compare(control.checked, false) - compare(control.pressed, false) - - // release on the right - mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton) - compare(pressedSpy.count, 5) - compare(control.pressed, true) - mouseMove(control, control.width * 2, control.height / 2, 0, Qt.LeftButton) - compare(control.pressed, true) - mouseRelease(control, control.width * 2, control.height / 2, Qt.LeftButton) - compare(clickedSpy.count, 2) - compare(checkedSpy.count, 3) - compare(pressedSpy.count, 6) - compare(control.checked, true) - compare(control.pressed, false) - - // release on the left - mousePress(control, control.width / 2, control.height / 2, Qt.LeftButton) - compare(pressedSpy.count, 7) - compare(control.pressed, true) - mouseMove(control, -control.width, control.height / 2, 0, Qt.LeftButton) - compare(control.pressed, true) - mouseRelease(control, -control.width, control.height / 2, Qt.LeftButton) - compare(clickedSpy.count, 2) - compare(checkedSpy.count, 4) - compare(pressedSpy.count, 8) - compare(control.checked, false) - compare(control.pressed, false) - - // right button - mousePress(control, control.width / 2, control.height / 2, Qt.RightButton) - compare(pressedSpy.count, 8) - compare(control.pressed, false) - mouseRelease(control, control.width / 2, control.height / 2, Qt.RightButton) - compare(clickedSpy.count, 2) - compare(checkedSpy.count, 4) - compare(pressedSpy.count, 8) - compare(control.checked, false) - compare(control.pressed, false) - - control.destroy() - } - - function test_keys() { - var control = toggleButton.createObject(testCase) - verify(control) - - checkedSpy.target = control - clickedSpy.target = control - verify(checkedSpy.valid) - verify(clickedSpy.valid) - - control.forceActiveFocus() - verify(control.activeFocus) - - // check - keyClick(Qt.Key_Space) - compare(clickedSpy.count, 1) - compare(checkedSpy.count, 1) - compare(control.checked, true) - - // uncheck - keyClick(Qt.Key_Space) - compare(clickedSpy.count, 2) - compare(checkedSpy.count, 2) - compare(control.checked, false) - - // no change - var keys = [Qt.Key_Enter, Qt.Key_Return, Qt.Key_Escape, Qt.Key_Tab] - for (var i = 0; i < keys.length; ++i) { - keyClick(keys[i]) - compare(clickedSpy.count, 2) - compare(checkedSpy.count, 2) - compare(control.checked, false) - } - - control.destroy() - } - - Component { - id: twoToggleButtones - Item { - property ToggleButton tb1: ToggleButton { id: tb1 } - property ToggleButton tb2: ToggleButton { id: tb2; checked: tb1.checked; enabled: false } - } - } - - function test_binding() { - var container = twoToggleButtones.createObject(testCase) - verify(container) - - compare(container.tb1.checked, false) - compare(container.tb2.checked, false) - - container.tb1.checked = true - compare(container.tb1.checked, true) - compare(container.tb2.checked, true) - - container.tb1.checked = false - compare(container.tb1.checked, false) - compare(container.tb2.checked, false) - - container.destroy() - } -} diff --git a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-background.qml b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-background.qml deleted file mode 100644 index 1ae976f0..00000000 --- a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-background.qml +++ /dev/null @@ -1,10 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -ToggleButton { - text: "ToggleButton" - background: Rectangle { - color: "transparent" - border.color: "red" - } -} diff --git a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-checked.qml b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-checked.qml deleted file mode 100644 index bbb60a05..00000000 --- a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-checked.qml +++ /dev/null @@ -1,7 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -ToggleButton { - text: "Checked" - checked: true -} diff --git a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-disabled.qml b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-disabled.qml deleted file mode 100644 index 72bfbb39..00000000 --- a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-disabled.qml +++ /dev/null @@ -1,7 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -ToggleButton { - text: "Disabled" - enabled: false -} diff --git a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-focused.qml b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-focused.qml deleted file mode 100644 index fdcb4d42..00000000 --- a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-focused.qml +++ /dev/null @@ -1,7 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -ToggleButton { - text: "Focused" - focus: true -} diff --git a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-indicator.qml b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-indicator.qml deleted file mode 100644 index 7acbe8e4..00000000 --- a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-indicator.qml +++ /dev/null @@ -1,11 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -ToggleButton { - text: "ToggleButton" - Rectangle { - anchors.fill: indicator - color: "transparent" - border.color: "red" - } -} diff --git a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-label.qml b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-label.qml deleted file mode 100644 index 1af32b9e..00000000 --- a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-label.qml +++ /dev/null @@ -1,11 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -ToggleButton { - text: "ToggleButton" - Rectangle { - anchors.fill: label - color: "transparent" - border.color: "red" - } -} diff --git a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-normal.qml b/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-normal.qml deleted file mode 100644 index fcdfdd7d..00000000 --- a/tests/auto/snippets/data/togglebutton/qtquickcontrols2-togglebutton-normal.qml +++ /dev/null @@ -1,6 +0,0 @@ -import QtQuick 2.0 -import QtQuick.Controls 2.0 - -ToggleButton { - text: "Normal" -} diff --git a/tests/benchmarks/objectcount/tst_objectcount.cpp b/tests/benchmarks/objectcount/tst_objectcount.cpp index f7432d2e..49400c22 100644 --- a/tests/benchmarks/objectcount/tst_objectcount.cpp +++ b/tests/benchmarks/objectcount/tst_objectcount.cpp @@ -221,10 +221,6 @@ void tst_ObjectCount::testCount_data() << QByteArray("import QtQuick.Controls 1.3; TextField { }") << QByteArray("import QtQuick.Controls 2.0; TextField { }"); - QTest::newRow("ToggleButton") - << QByteArray() - << QByteArray("import QtQuick.Controls 2.0; ToggleButton { }"); - QTest::newRow("ToolBar") << QByteArray("import QtQuick.Controls 1.3; ToolBar { }") << QByteArray("import QtQuick.Controls 2.0; ToolBar { }"); diff --git a/tests/manual/fonts/main.qml b/tests/manual/fonts/main.qml index d7c16ab0..978435c0 100644 --- a/tests/manual/fonts/main.qml +++ b/tests/manual/fonts/main.qml @@ -82,7 +82,6 @@ ApplicationWindow { } TextField { placeholder.text: "TextField" } TextArea { placeholder.text: "TextArea" } - ToggleButton { text: "ToggleButton" } ToolButton { text: "ToolButton" } Tumbler { model: 3 } } -- cgit v1.2.3