aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/RadioButton.qml
diff options
context:
space:
mode:
Diffstat (limited to 'src/imports/controls/RadioButton.qml')
-rw-r--r--src/imports/controls/RadioButton.qml53
1 files changed, 15 insertions, 38 deletions
diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml
index 8e1e0bce..1100273a 100644
--- a/src/imports/controls/RadioButton.qml
+++ b/src/imports/controls/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,63 +35,40 @@
****************************************************************************/
import QtQuick 2.6
-import Qt.labs.controls 1.0
-import Qt.labs.templates 1.0 as T
+import QtQuick.Controls 2.0
+import QtQuick.Controls.impl 2.0
+import QtQuick.Templates 2.0 as T
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: 6
- 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
- border.width: 1
- border.color: (control.pressed ? "#26282a" : "#353637")
- color: control.pressed ? "#e4e4e4" : "#f6f6f6"
-
- Rectangle {
- x: (parent.width - width) / 2
- y: (parent.height - height) / 2
- width: 20
- height: 20
- radius: width / 2
- color: control.pressed ? "#26282a" : "#353637"
- visible: control.checked
- }
+ 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
- color: control.pressed ? "#26282a" : "#353637"
+ color: control.down ? "#26282a" : "#353637"
elide: Text.ElideRight
visible: control.text
horizontalAlignment: Text.AlignLeft
verticalAlignment: Text.AlignVCenter
+ opacity: enabled ? 1 : 0.3
}
- //! [label]
}