QML-RadioButton

RadioButton {
    id:root2
    checked: false
    property color checkedColor: "#E5F012"
    property int node_id: 2;
    onClicked: {
        if(root2.checked)
        {
            swipeView.currentIndex = 1;
        }
    }
    contentItem:Text {
        text: "网络交换机"
        font.pixelSize: 15;
        opacity: enabled ? 1.0 : 0.3
        color: "white";
        verticalAlignment: Text.AlignVCenter
        anchors.left: parent.left;
        anchors.leftMargin: 27;
        anchors.verticalCenter: parent.verticalCenter;
    }
    indicator: Rectangle {
        anchors.left: parent.left;
        anchors.verticalCenter: parent.verticalCenter
         20; height: width
        antialiasing: true
        radius: width/2
        border. 2
        border.color: selectCol.bkcolor;
        Rectangle {
            anchors.centerIn: parent
             parent.width*0.7; height: width
            antialiasing: true
            radius: width/2
            color: selectCol.checkedColor
            visible: root2.checked
        }
    }
}

原文地址:https://www.cnblogs.com/judes/p/13451385.html