aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/controls')
-rw-r--r--src/imports/controls/RadioButton.qml20
-rw-r--r--src/imports/controls/RadioDelegate.qml85
-rw-r--r--src/imports/controls/RadioIndicator.qml59
-rw-r--r--src/imports/controls/controls.pri2
-rw-r--r--src/imports/controls/designer/RadioDelegateSpecifics.qml56
-rw-r--r--src/imports/controls/designer/designer.pri1
-rw-r--r--src/imports/controls/designer/qtlabscontrols.metainfo15
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols-radiodelegate-background.pngbin0 -> 3727 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols-radiodelegate-contentItem.pngbin0 -> 3595 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols-radiodelegate-indicator.pngbin0 -> 3595 bytes
-rw-r--r--src/imports/controls/doc/images/qtquickcontrols-radiodelegate.gifbin0 -> 16357 bytes
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols-radiodelegate-background.qml38
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols-radiodelegate-contentItem.qml39
-rw-r--r--src/imports/controls/doc/snippets/qtquickcontrols-radiodelegate-indicator.qml39
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc25
-rw-r--r--src/imports/controls/doc/src/qtquickcontrols2-delegates.qdoc8
-rw-r--r--src/imports/controls/material/RadioButton.qml27
-rw-r--r--src/imports/controls/material/RadioDelegate.qml83
-rw-r--r--src/imports/controls/material/RadioIndicator.qml69
-rw-r--r--src/imports/controls/material/material.pri2
-rw-r--r--src/imports/controls/qtquickcontrolsplugin.cpp2
-rw-r--r--src/imports/controls/universal/RadioButton.qml40
-rw-r--r--src/imports/controls/universal/RadioDelegate.qml98
-rw-r--r--src/imports/controls/universal/RadioIndicator.qml77
-rw-r--r--src/imports/controls/universal/qtquickuniversalstyleplugin.cpp4
-rw-r--r--src/imports/controls/universal/universal.pri2
26 files changed, 710 insertions, 81 deletions
diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml
index 1c4966e5..fbb75585 100644
--- a/src/imports/controls/RadioButton.qml
+++ b/src/imports/controls/RadioButton.qml
@@ -53,26 +53,10 @@ T.RadioButton {
opacity: enabled ? 1 : 0.2
//! [indicator]
- indicator: Rectangle {
- implicitWidth: 28
- implicitHeight: 28
+ indicator: RadioIndicator {
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: width / 2
- color: control.pressed ? (control.activeKeyFocus ? "#cce0ff" : "#e4e4e4") : "#f6f6f6"
- border.width: control.activeKeyFocus ? 2 : 1
- border.color: control.activeKeyFocus ? "#0066ff" : (control.pressed ? "#26282a" : "#353637")
-
- Rectangle {
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- width: 20
- height: 20
- radius: width / 2
- color: parent.border.color
- visible: control.checked
- }
+ control: control
}
//! [indicator]
diff --git a/src/imports/controls/RadioDelegate.qml b/src/imports/controls/RadioDelegate.qml
new file mode 100644
index 00000000..55186ae5
--- /dev/null
+++ b/src/imports/controls/RadioDelegate.qml
@@ -0,0 +1,85 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs 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 Qt.labs.templates 1.0 as T
+
+T.RadioDelegate {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
+ indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
+
+ padding: 12
+ spacing: 12
+
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: control.checkable && control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.checkable && !control.mirrored ? control.indicator.width + control.spacing : 0
+
+ text: control.text
+ font: control.font
+ color: control.enabled ? "#26282a" : "#bdbebf"
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+ //! [contentItem]
+
+ //! [indicator]
+ indicator: RadioIndicator {
+ x: control.mirrored ? control.leftPadding : control.width - width - control.rightPadding
+ y: control.topPadding + (control.availableHeight - height) / 2
+
+ control: control
+ }
+ //! [indicator]
+
+ //! [background]
+ background: Rectangle {
+ implicitWidth: 100
+ implicitHeight: 40
+ visible: control.pressed || control.highlighted
+ color: control.pressed ? "#bdbebf" : "#eeeeee"
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/RadioIndicator.qml b/src/imports/controls/RadioIndicator.qml
new file mode 100644
index 00000000..a5fb8e55
--- /dev/null
+++ b/src/imports/controls/RadioIndicator.qml
@@ -0,0 +1,59 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs 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
+
+Rectangle {
+ implicitWidth: 28
+ implicitHeight: 28
+
+ radius: width / 2
+ color: control.pressed ? (control.activeFocus ? "#cce0ff" : "#e4e4e4") : "#f6f6f6"
+ border.width: control.activeFocus ? 2 : 1
+ border.color: control.activeFocus ? "#0066ff" : (control.pressed ? "#26282a" : "#353637")
+
+ property Item control
+
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 20
+ height: 20
+ radius: width / 2
+ color: parent.border.color
+ visible: control.checked
+ }
+}
diff --git a/src/imports/controls/controls.pri b/src/imports/controls/controls.pri
index 43a09f19..e71c7106 100644
--- a/src/imports/controls/controls.pri
+++ b/src/imports/controls/controls.pri
@@ -28,6 +28,8 @@ QML_CONTROLS = \
Popup.qml \
ProgressBar.qml \
RadioButton.qml \
+ RadioDelegate.qml \
+ RadioIndicator.qml \
RangeSlider.qml \
ScrollBar.qml \
ScrollIndicator.qml \
diff --git a/src/imports/controls/designer/RadioDelegateSpecifics.qml b/src/imports/controls/designer/RadioDelegateSpecifics.qml
new file mode 100644
index 00000000..767a03e7
--- /dev/null
+++ b/src/imports/controls/designer/RadioDelegateSpecifics.qml
@@ -0,0 +1,56 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs 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
+
+ ButtonSection {
+ caption: qsTr("Radio Delegate")
+ width: parent.width
+ }
+
+ 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 6636e160..b5b14f77 100644
--- a/src/imports/controls/designer/designer.pri
+++ b/src/imports/controls/designer/designer.pri
@@ -20,6 +20,7 @@ QML_FILES += \
$$PWD/PaneSpecifics.qml \
$$PWD/ProgressBarSpecifics.qml \
$$PWD/RadioButtonSpecifics.qml \
+ $$PWD/RadioDelegateSpecifics.qml \
$$PWD/SliderSpecifics.qml \
$$PWD/SpinBoxSpecifics.qml \
$$PWD/SwipeDelegateSpecifics.qml \
diff --git a/src/imports/controls/designer/qtlabscontrols.metainfo b/src/imports/controls/designer/qtlabscontrols.metainfo
index 0006880a..55110b15 100644
--- a/src/imports/controls/designer/qtlabscontrols.metainfo
+++ b/src/imports/controls/designer/qtlabscontrols.metainfo
@@ -208,6 +208,21 @@ MetaInfo {
}
Type {
+ name: "Qt.labs.controls.RadioDelegate"
+ icon: "images/radiobutton-icon16.png"
+
+ ItemLibraryEntry {
+ name: "Radio Delegate"
+ category: "Qt Labs - Controls"
+ libraryIcon: "images/radiobutton-icon.png"
+ version: "1.0"
+ requiredImport: "Qt.labs.controls"
+
+ Property { name: "text"; type: "binding"; value: "qsTr('Radio Delegate')" }
+ }
+ }
+
+ Type {
name: "Qt.labs.controls.Slider"
icon: "images/slider-icon16.png"
diff --git a/src/imports/controls/doc/images/qtquickcontrols-radiodelegate-background.png b/src/imports/controls/doc/images/qtquickcontrols-radiodelegate-background.png
new file mode 100644
index 00000000..f9ff48c2
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols-radiodelegate-background.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols-radiodelegate-contentItem.png b/src/imports/controls/doc/images/qtquickcontrols-radiodelegate-contentItem.png
new file mode 100644
index 00000000..9ede889f
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols-radiodelegate-contentItem.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols-radiodelegate-indicator.png b/src/imports/controls/doc/images/qtquickcontrols-radiodelegate-indicator.png
new file mode 100644
index 00000000..9d8cbdbd
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols-radiodelegate-indicator.png
Binary files differ
diff --git a/src/imports/controls/doc/images/qtquickcontrols-radiodelegate.gif b/src/imports/controls/doc/images/qtquickcontrols-radiodelegate.gif
new file mode 100644
index 00000000..851064e9
--- /dev/null
+++ b/src/imports/controls/doc/images/qtquickcontrols-radiodelegate.gif
Binary files differ
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols-radiodelegate-background.qml b/src/imports/controls/doc/snippets/qtquickcontrols-radiodelegate-background.qml
new file mode 100644
index 00000000..8d6fd78a
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols-radiodelegate-background.qml
@@ -0,0 +1,38 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.labs.controls 1.0
+
+RadioDelegate {
+ text: "RadioDelegate"
+ checked: true
+ background: Rectangle {
+ color: 'transparent'
+ border.color: 'red'
+ }
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols-radiodelegate-contentItem.qml b/src/imports/controls/doc/snippets/qtquickcontrols-radiodelegate-contentItem.qml
new file mode 100644
index 00000000..a1b08c4e
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols-radiodelegate-contentItem.qml
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.labs.controls 1.0
+
+RadioDelegate {
+ text: "RadioDelegate"
+ checked: true
+ Rectangle {
+ anchors.fill: contentItem
+ color: "transparent"
+ border.color: "red"
+ }
+}
diff --git a/src/imports/controls/doc/snippets/qtquickcontrols-radiodelegate-indicator.qml b/src/imports/controls/doc/snippets/qtquickcontrols-radiodelegate-indicator.qml
new file mode 100644
index 00000000..ffb91097
--- /dev/null
+++ b/src/imports/controls/doc/snippets/qtquickcontrols-radiodelegate-indicator.qml
@@ -0,0 +1,39 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the documentation of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:FDL$
+** 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 Free Documentation License Usage
+** Alternatively, this file may be used under the terms of the GNU Free
+** Documentation License version 1.3 as published by the Free Software
+** Foundation and appearing in the file included in the packaging of
+** this file. Please review the following information to ensure
+** the GNU Free Documentation License version 1.3 requirements
+** will be met: http://www.gnu.org/copyleft/fdl.html.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+import QtQuick 2.0
+import Qt.labs.controls 1.0
+
+RadioDelegate {
+ text: "RadioDelegate"
+ checked: true
+ Rectangle {
+ anchors.fill: indicator
+ color: "transparent"
+ border.color: "red"
+ }
+}
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
index 197e2529..103da5fe 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-customize.qdoc
@@ -338,6 +338,30 @@
\snippet RadioButton.qml indicator
+ \section1 Customizing RadioDelegate
+
+ RadioDelegate consists of three visual items: \l {Control::background}{background},
+ \l {Control::contentItem}{contentItem} and \l {AbstractButton::indicator}{indicator}.
+
+ \section3 Background
+
+ \image qtquickcontrols-radiodelegate-background.png
+
+ \snippet RadioDelegate.qml background
+
+ \section3 Content item
+
+ \image qtquickcontrols-radiodelegate-contentItem.png
+
+ \snippet RadioDelegate.qml contentItem
+
+ \section3 Indicator
+
+ \image qtquickcontrols-radiodelegate-indicator.png
+
+ \snippet RadioDelegate.qml indicator
+
+
\section1 Customizing RangeSlider
RangeSlider consists of three visual items:
@@ -539,7 +563,6 @@
\snippet Switch.qml indicator
-
\section1 Customizing TabBar
TODO
diff --git a/src/imports/controls/doc/src/qtquickcontrols2-delegates.qdoc b/src/imports/controls/doc/src/qtquickcontrols2-delegates.qdoc
index 40c52996..40500e99 100644
--- a/src/imports/controls/doc/src/qtquickcontrols2-delegates.qdoc
+++ b/src/imports/controls/doc/src/qtquickcontrols2-delegates.qdoc
@@ -44,5 +44,13 @@
\l ItemDelegate presents a checkable control that can be pressed and
clicked by the user.
+
+ \section1 RadioDelegate Control
+
+ \image qtquickcontrols-radiodelegate.gif
+
+ \l RadioDelegate presents a checkable control that can be toggled on
+ (checked) or off (unchecked). Radio delegates are typically used to select
+ one option from a set of options.
*/
diff --git a/src/imports/controls/material/RadioButton.qml b/src/imports/controls/material/RadioButton.qml
index 83dbcefa..14b1c0cc 100644
--- a/src/imports/controls/material/RadioButton.qml
+++ b/src/imports/controls/material/RadioButton.qml
@@ -56,33 +56,10 @@ T.RadioButton {
bottomPadding: 14
//! [indicator]
- indicator: Rectangle {
+ indicator: RadioIndicator {
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
- implicitWidth: 20
- implicitHeight: 20
- radius: width / 2
- border.width: 2
- border.color: control.checked || control.pressed ? control.Material.accentColor : control.Material.secondaryTextColor
- color: "transparent"
-
- Ripple {
- width: parent.width
- height: width
- control: control
- colored: control.checked
- opacity: control.pressed || control.activeKeyFocus ? 1 : 0
- }
-
- Rectangle {
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- width: 10
- height: 10
- radius: width / 2
- color: parent.border.color
- visible: control.checked || control.pressed
- }
+ control: control
}
//! [indicator]
diff --git a/src/imports/controls/material/RadioDelegate.qml b/src/imports/controls/material/RadioDelegate.qml
new file mode 100644
index 00000000..3ff49d4d
--- /dev/null
+++ b/src/imports/controls/material/RadioDelegate.qml
@@ -0,0 +1,83 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs 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 Qt.labs.templates 1.0 as T
+import Qt.labs.controls.material 1.0
+
+T.RadioDelegate {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
+ indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
+
+ padding: 16
+ spacing: 16
+
+ //! [indicator]
+ indicator: RadioIndicator {
+ x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ y: control.topPadding + (control.availableHeight - height) / 2
+ control: control
+ }
+ //! [indicator]
+
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: !control.mirrored ? 0 : control.indicator.width + control.spacing
+ rightPadding: control.mirrored ? 0 : control.indicator.width + control.spacing
+
+ text: control.text
+ font: control.font
+ color: control.enabled ? control.Material.primaryTextColor : control.Material.hintTextColor
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+ }
+ //! [contentItem]
+
+ //! [background]
+ background: Rectangle {
+ visible: control.pressed || control.highlighted
+ color: control.pressed ? control.Material.flatButtonPressColor : control.Material.listHighlightColor
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/material/RadioIndicator.qml b/src/imports/controls/material/RadioIndicator.qml
new file mode 100644
index 00000000..7db0c60f
--- /dev/null
+++ b/src/imports/controls/material/RadioIndicator.qml
@@ -0,0 +1,69 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs 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 Qt.labs.controls.material 1.0
+import Qt.labs.controls.material.impl 1.0
+
+Rectangle {
+ implicitWidth: 20
+ implicitHeight: 20
+ radius: width / 2
+ border.width: 2
+ border.color: control.checked || control.pressed ? control.Material.accentColor : control.Material.secondaryTextColor
+ color: "transparent"
+
+ property alias control: ripple.control
+
+ Ripple {
+ id: ripple
+ width: parent.width
+ height: width
+ control: control
+ colored: control.checked
+ opacity: control.pressed || control.activeFocus ? 1 : 0
+ }
+
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 10
+ height: 10
+ radius: width / 2
+ color: parent.border.color
+ visible: control.checked || control.pressed
+ }
+}
diff --git a/src/imports/controls/material/material.pri b/src/imports/controls/material/material.pri
index 6b2c3d6c..6ab08d31 100644
--- a/src/imports/controls/material/material.pri
+++ b/src/imports/controls/material/material.pri
@@ -32,6 +32,8 @@ QML_FILES += \
$$PWD/Popup.qml \
$$PWD/ProgressBar.qml \
$$PWD/RadioButton.qml \
+ $$PWD/RadioDelegate.qml \
+ $$PWD/RadioIndicator.qml \
$$PWD/RangeSlider.qml \
$$PWD/Ripple.qml \
$$PWD/ScrollBar.qml \
diff --git a/src/imports/controls/qtquickcontrolsplugin.cpp b/src/imports/controls/qtquickcontrolsplugin.cpp
index 7f0e20e0..1d611c79 100644
--- a/src/imports/controls/qtquickcontrolsplugin.cpp
+++ b/src/imports/controls/qtquickcontrolsplugin.cpp
@@ -113,6 +113,7 @@ void QtQuickControlsPlugin::registerTypes(const char *uri)
qmlRegisterType(selector.select(QStringLiteral("Popup.qml")), uri, 1, 0, "Popup");
qmlRegisterType(selector.select(QStringLiteral("ProgressBar.qml")), uri, 1, 0, "ProgressBar");
qmlRegisterType(selector.select(QStringLiteral("RadioButton.qml")), uri, 1, 0, "RadioButton");
+ qmlRegisterType(selector.select(QStringLiteral("RadioDelegate.qml")), uri, 1, 0, "RadioDelegate");
qmlRegisterType(selector.select(QStringLiteral("RangeSlider.qml")), uri, 1, 0, "RangeSlider");
qmlRegisterType(selector.select(QStringLiteral("ScrollBar.qml")), uri, 1, 0, "ScrollBar");
qmlRegisterType(selector.select(QStringLiteral("ScrollIndicator.qml")), uri, 1, 0, "ScrollIndicator");
@@ -145,6 +146,7 @@ void QtQuickControlsPlugin::initializeEngine(QQmlEngine *engine, const char *uri
const QString pluginBasePath = QQuickPluginUtils::pluginBasePath(*this);
qmlRegisterType(pluginBasePath + QStringLiteral("/CheckIndicator.qml"), import, 1, 0, "CheckIndicator");
+ qmlRegisterType(pluginBasePath + QStringLiteral("/RadioIndicator.qml"), import, 1, 0, "RadioIndicator");
}
QT_END_NAMESPACE
diff --git a/src/imports/controls/universal/RadioButton.qml b/src/imports/controls/universal/RadioButton.qml
index a391d670..92652304 100644
--- a/src/imports/controls/universal/RadioButton.qml
+++ b/src/imports/controls/universal/RadioButton.qml
@@ -37,6 +37,7 @@
import QtQuick 2.6
import Qt.labs.templates 1.0 as T
import Qt.labs.controls.universal 1.0
+import Qt.labs.controls.universal.impl 1.0
T.RadioButton {
id: control
@@ -54,45 +55,10 @@ T.RadioButton {
property bool useSystemFocusVisuals: true
//! [indicator]
- indicator: Rectangle {
- id: outerEllipse
- implicitWidth: 20
- implicitHeight: 20
+ indicator: RadioIndicator {
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: width / 2
- color: "transparent"
- border.width: 2 // RadioButtonBorderThemeThickness
- border.color: control.checked ? "transparent" :
- !control.enabled ? control.Universal.baseLowColor :
- control.pressed ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
-
- Rectangle {
- id: checkOuterEllipse
- width: parent.width
- height: parent.height
-
- radius: width / 2
- opacity: control.checked ? 1 : 0
- color: "transparent"
- border.width: 2 // RadioButtonBorderThemeThickness
- border.color: !control.enabled ? control.Universal.baseLowColor :
- control.pressed ? control.Universal.baseMediumColor : control.Universal.accent
- }
-
- Rectangle {
- id: checkGlyph
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- width: parent.width / 2
- height: parent.height / 2
-
- radius: width / 2
- opacity: control.checked ? 1 : 0
- color: !control.enabled ? control.Universal.baseLowColor :
- control.pressed ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
- }
+ control: control
}
//! [indicator]
diff --git a/src/imports/controls/universal/RadioDelegate.qml b/src/imports/controls/universal/RadioDelegate.qml
new file mode 100644
index 00000000..ed67609b
--- /dev/null
+++ b/src/imports/controls/universal/RadioDelegate.qml
@@ -0,0 +1,98 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs 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 Qt.labs.templates 1.0 as T
+import Qt.labs.controls.universal 1.0
+
+T.RadioDelegate {
+ id: control
+
+ implicitWidth: Math.max(background ? background.implicitWidth : 0,
+ contentItem.implicitWidth + leftPadding + rightPadding)
+ implicitHeight: Math.max(background ? background.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
+ indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
+ baselineOffset: contentItem.y + contentItem.baselineOffset
+
+ spacing: 12
+
+ topPadding: 11
+ leftPadding: 12
+ rightPadding: 12
+ bottomPadding: 13
+
+ property Item control
+
+ //! [indicator]
+ indicator: RadioIndicator {
+ x: text ? (control.mirrored ? control.leftPadding : control.width - width - control.rightPadding) : control.leftPadding + (control.availableWidth - width) / 2
+ y: control.topPadding + (control.availableHeight - height) / 2
+ control: control
+ }
+ //! [indicator]
+
+ //! [contentItem]
+ contentItem: Text {
+ leftPadding: !control.mirrored ? 0 : control.indicator.width + control.spacing
+ rightPadding: control.mirrored ? 0 : control.indicator.width + control.spacing
+
+ text: control.text
+ font: control.font
+ elide: Text.ElideRight
+ visible: control.text
+ horizontalAlignment: Text.AlignLeft
+ verticalAlignment: Text.AlignVCenter
+
+ color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ }
+ //! [contentItem]
+
+ //! [background]
+ background: Rectangle {
+ visible: control.pressed || control.highlighted || control.activeFocus
+ color: control.pressed ? control.Universal.listMediumColor : control.Universal.altMediumLowColor
+ Rectangle {
+ width: parent.width
+ height: parent.height
+ visible: control.activeFocus || control.highlighted
+ color: control.Universal.accent
+ opacity: control.Universal.theme === Universal.Light ? 0.4 : 0.6
+ }
+
+ }
+ //! [background]
+}
diff --git a/src/imports/controls/universal/RadioIndicator.qml b/src/imports/controls/universal/RadioIndicator.qml
new file mode 100644
index 00000000..f1407e46
--- /dev/null
+++ b/src/imports/controls/universal/RadioIndicator.qml
@@ -0,0 +1,77 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 The Qt Company Ltd.
+** Contact: http://www.qt.io/licensing/
+**
+** This file is part of the Qt Labs 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 Qt.labs.controls.universal 1.0
+
+Rectangle {
+ implicitWidth: 20
+ implicitHeight: 20
+ radius: width / 2
+ color: "transparent"
+ border.width: 2 // RadioButtonBorderThemeThickness
+ border.color: control.checked ? "transparent" :
+ !control.enabled ? control.Universal.baseLowColor :
+ control.pressed ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
+
+ property var control
+
+ Rectangle {
+ id: checkOuterEllipse
+ width: parent.width
+ height: parent.height
+
+ radius: width / 2
+ opacity: control.checked ? 1 : 0
+ color: "transparent"
+ border.width: 2 // RadioButtonBorderThemeThickness
+ border.color: !control.enabled ? control.Universal.baseLowColor :
+ control.pressed ? control.Universal.baseMediumColor : control.Universal.accent
+ }
+
+ Rectangle {
+ id: checkGlyph
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: parent.width / 2
+ height: parent.height / 2
+
+ radius: width / 2
+ opacity: control.checked ? 1 : 0
+ color: !control.enabled ? control.Universal.baseLowColor :
+ control.pressed ? control.Universal.baseMediumColor : control.Universal.baseMediumHighColor
+ }
+}
diff --git a/src/imports/controls/universal/qtquickuniversalstyleplugin.cpp b/src/imports/controls/universal/qtquickuniversalstyleplugin.cpp
index d940b0e6..31aaa7d4 100644
--- a/src/imports/controls/universal/qtquickuniversalstyleplugin.cpp
+++ b/src/imports/controls/universal/qtquickuniversalstyleplugin.cpp
@@ -43,6 +43,7 @@
#include "qquickuniversaltheme_p.h"
#include <QtQuickControls/private/qquickcolorimageprovider_p.h>
+#include <QtQuickControls/private/qquickpluginutils_p.h>
static inline void initResources()
{
@@ -91,6 +92,9 @@ void QtQuickUniversalStylePlugin::initializeEngine(QQmlEngine *engine, const cha
qmlRegisterType<QQuickUniversalProgressRingAnimator>(import, 1, 0, "ProgressRingAnimator");
qmlRegisterType<QQuickUniversalProgressStrip>(import, 1, 0, "ProgressStrip");
qmlRegisterType<QQuickUniversalProgressStripAnimator>(import, 1, 0, "ProgressStripAnimator");
+
+ const QString pluginBasePath = QQuickPluginUtils::pluginBasePath(*this);
+ qmlRegisterType(QUrl(pluginBasePath + QStringLiteral("/RadioIndicator.qml")), import, 1, 0, "RadioIndicator");
}
QString QtQuickUniversalStylePlugin::name() const
diff --git a/src/imports/controls/universal/universal.pri b/src/imports/controls/universal/universal.pri
index ba07f994..ea4f5d43 100644
--- a/src/imports/controls/universal/universal.pri
+++ b/src/imports/controls/universal/universal.pri
@@ -20,6 +20,8 @@ QML_FILES += \
$$PWD/Popup.qml \
$$PWD/ProgressBar.qml \
$$PWD/RadioButton.qml \
+ $$PWD/RadioDelegate.qml \
+ $$PWD/RadioIndicator.qml \
$$PWD/RangeSlider.qml \
$$PWD/ScrollBar.qml \
$$PWD/ScrollIndicator.qml \