Welcome to mirror list, hosted at ThFree Co, Russian Federation.

RadioButton.qml « Widgets « qml « resources - github.com/Ultimaker/Cura.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 13aee7ba9091d9daec9605bde10dae19d1258722 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Copyright (c) 2019 Ultimaker B.V.
// Cura is released under the terms of the LGPLv3 or higher.

import QtQuick 2.10
import QtQuick.Controls 2.3

import UM 1.3 as UM
import Cura 1.0 as Cura


//
// Cura-style RadioButton.
//
RadioButton
{
    id: radioButton

    font: UM.Theme.getFont("default")

    background: Item
    {
        anchors.fill: parent
    }

    indicator: Rectangle
    {
        implicitWidth: UM.Theme.getSize("radio_button").width
        implicitHeight: UM.Theme.getSize("radio_button").height
        anchors.verticalCenter: parent.verticalCenter
        anchors.alignWhenCentered: false
        radius: width / 2
        border.width: UM.Theme.getSize("default_lining").width
        border.color: radioButton.hovered ? UM.Theme.getColor("small_button_text") : UM.Theme.getColor("small_button_text_hover")

        Rectangle
        {
            width: (parent.width / 2) | 0
            height: width
            anchors.centerIn: parent
            radius: width / 2
            color: radioButton.hovered ? UM.Theme.getColor("primary_button_hover") : UM.Theme.getColor("primary_button")
            visible: radioButton.checked
        }
    }

    contentItem: Label
    {
        verticalAlignment: Text.AlignVCenter
        leftPadding: radioButton.indicator.width + radioButton.spacing
        text: radioButton.text
        font: radioButton.font
        color: UM.Theme.getColor("text")
        renderType: Text.NativeRendering
    }
}