aboutsummaryrefslogtreecommitdiffstats
path: root/src/imports/controls/RadioButton.qml
diff options
context:
space:
mode:
authorJ-P Nurmi <jpnurmi@qt.io>2017-10-31 14:55:34 +0100
committerJ-P Nurmi <jpnurmi@qt.io>2017-11-02 09:12:18 +0000
commit1350b91aaf9a343d721ea085fd924812e518ccbd (patch)
treed2d5c0740001ae51b79469e23f2e0db2c8933765 /src/imports/controls/RadioButton.qml
parent0504150e4a0a3874a8e431af351277f7342dac95 (diff)
Default: merge RadioIndicator back to RadioButton & RadioDelegate
See the previous commit (CheckIndicator) for more details. Before: running: qmlbench/benchmarks/auto/creation/quick.controls2/delegates_radiobutton.qml [...] Average: 91.6 frames; using samples; MedianAll=91; StdDev=1.51658, CoV=0.0165565 After: running: qmlbench/benchmarks/auto/creation/quick.controls2/delegates_radiobutton.qml [...] Average: 95.8 frames; using samples; MedianAll=96; StdDev=2.04939, CoV=0.0213924 Change-Id: Ic185241767d0b9422e86919356e3155e00803e56 Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/imports/controls/RadioButton.qml')
-rw-r--r--src/imports/controls/RadioButton.qml22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/imports/controls/RadioButton.qml b/src/imports/controls/RadioButton.qml
index 2ea9dbfa..a9f63652 100644
--- a/src/imports/controls/RadioButton.qml
+++ b/src/imports/controls/RadioButton.qml
@@ -52,10 +52,28 @@ T.RadioButton {
padding: 6
spacing: 6
- indicator: RadioIndicator {
+ // keep in sync with RadioDelegate.qml (shared RadioIndicator.qml was removed for performance reasons)
+ indicator: Rectangle {
+ implicitWidth: 28
+ implicitHeight: 28
+
x: text ? (control.mirrored ? control.width - width - control.rightPadding : control.leftPadding) : control.leftPadding + (control.availableWidth - width) / 2
y: control.topPadding + (control.availableHeight - height) / 2
- control: control
+
+ radius: width / 2
+ color: control.down ? control.palette.light : control.palette.base
+ border.width: control.visualFocus ? 2 : 1
+ border.color: control.visualFocus ? control.palette.highlight : control.palette.mid
+
+ Rectangle {
+ x: (parent.width - width) / 2
+ y: (parent.height - height) / 2
+ width: 20
+ height: 20
+ radius: width / 2
+ color: control.palette.text
+ visible: control.checked
+ }
}
contentItem: CheckLabel {