aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/universal/RadioButton.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/controls/universal/RadioButton.qml')
-rw-r--r--src/imports/controls/universal/RadioButton.qml71
1 files changed, 15 insertions, 56 deletions
diff --git a/src/imports/controls/universal/RadioButton.qml b/src/imports/controls/universal/RadioButton.qml
index 95e55db9..b8986488 100644
--- a/src/imports/controls/universal/RadioButton.qml
+++ b/src/imports/controls/universal/RadioButton.qml
@@ -1,9 +1,9 @@
/****************************************************************************
**
-** Copyright (C) 2015 The Qt Company Ltd.
+** 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.
+** This file is part of the Qt Quick Controls 2 module of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL3$
** Commercial License Usage
@@ -35,75 +35,34 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.templates 1.0 as T
-import Qt.labs.controls.universal 1.0
+import QtQuick.Templates 2.0 as T
+import QtQuick.Controls.Universal 2.0
+import QtQuick.Controls.Universal.impl 2.0
T.RadioButton {
id: control
implicitWidth: Math.max(background ? background.implicitWidth : 0,
- (label ? label.implicitWidth : 0) +
- (indicator ? indicator.implicitWidth : 0) +
- (label && indicator ? spacing : 0) + leftPadding + rightPadding)
+ contentItem.implicitWidth + leftPadding + rightPadding)
implicitHeight: Math.max(background ? background.implicitHeight : 0,
- Math.max(label ? label.implicitHeight : 0,
+ Math.max(contentItem.implicitHeight,
indicator ? indicator.implicitHeight : 0) + topPadding + bottomPadding)
- baselineOffset: label ? label.y + label.baselineOffset : 0
+ baselineOffset: contentItem.y + contentItem.baselineOffset
padding: 6
spacing: 8
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]
- //! [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
+ contentItem: Text {
+ leftPadding: control.indicator && !control.mirrored ? control.indicator.width + control.spacing : 0
+ rightPadding: control.indicator && control.mirrored ? control.indicator.width + control.spacing : 0
text: control.text
font: control.font
@@ -112,7 +71,7 @@ T.RadioButton {
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
- color: !control.enabled ? control.Universal.baseLowColor : control.Universal.baseHighColor
+ opacity: enabled ? 1.0 : 0.2
+ color: control.Universal.foreground
}
- //! [label]
}