aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@theqtcompany.com>2015-09-25 19:28:36 +0200
committerJ-P Nurmi <jpnurmi@theqtcompany.com>2015-09-25 19:49:47 +0000
commit46215a8bcc4423fe79be4e4830435a1e10db22e7 (patch)
tree319cad15d62597bea6f626ad1ade7774fb864e62 /src/imports/controls
parentd703de8752e07cb12e8ce2e2a05d608f2b26425a (diff)
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 <liang.qi@theqtcompany.com>
Diffstat (limited to 'src/imports/controls')
-rw-r--r--src/imports/controls/ToggleButton.qml106
-rw-r--r--src/imports/controls/controls.pri1
-rw-r--r--src/imports/controls/designer/ToggleButtonSpecifics.qml81
-rw-r--r--src/imports/controls/designer/designer.pri1
-rw-r--r--src/imports/controls/designer/qtquickcontrols2.metainfo15
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc26
-rw-r--r--src/imports/controls/qtquickcontrols2plugin.cpp1
7 files changed, 1 insertions, 230 deletions
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
@@ -196,21 +196,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");