Warning, /education/marble/examples/cpp/marble-game/CustomRadioButton.qml is written in an unsupported language. File is not indexed.
0001 // SPDX-License-Identifier: LGPL-2.1-or-later 0002 // 0003 // SPDX-FileCopyrightText: 2014 Abhinav Gangwar <abhgang@gmail.com> 0004 // 0005 0006 0007 import QtQuick 2.0 0008 import QtQuick.Controls 1.2 0009 import QtQuick.Controls.Styles 1.2 0010 0011 RadioButton { 0012 id: radioButton 0013 0014 signal radioButtonClick() 0015 0016 property int radioButtonWidth: 150 0017 property int radioButtonHeight: 75 0018 0019 property real labelSize: radioButtonWidth/8 0020 0021 property color labelColor: "black" 0022 0023 property color borderColor: "transparent" 0024 property color onHoverColor: "crimson" 0025 property color normalColor: "lightblue" 0026 0027 property string labelText: qsTr("Radio Button") 0028 property alias buttonGroup: radioButton.exclusiveGroup 0029 0030 ExclusiveGroup { id: group } 0031 0032 text: labelText 0033 exclusiveGroup: group 0034 style: RadioButtonStyle { 0035 indicator: Rectangle { 0036 implicitWidth: 16 0037 implicitHeight: 16 0038 radius: 9 0039 border.color: ( control.activeFocus || control.checked ) ? "green" : "darkblue" 0040 border.width: 1 0041 Rectangle { 0042 anchors.fill: parent 0043 visible: control.checked 0044 color: "green" 0045 radius: 9 0046 anchors.margins: 4 0047 } 0048 } 0049 background: Rectangle { 0050 id: backgroundView 0051 implicitWidth: radioButtonWidth 0052 implicitHeight: radioButtonHeight 0053 border.width: control.hovered ? 2 : 1 0054 border.color: control.hovered ? radioButton.onHoverColor : radioButton.borderColor 0055 color: control.pressed ? Qt.darker( radioButton.normalColor, 1.5 ) : radioButton.normalColor 0056 Behavior on color { ColorAnimation{ duration: 50 } } 0057 radius: 6 0058 scale: control.pressed ? 1.1 : 1.0 0059 Behavior on scale { NumberAnimation{ duration: 50 } } 0060 } 0061 label: Text { 0062 font.pixelSize: labelSize 0063 color: labelColor 0064 text: labelText 0065 wrapMode: Text.WordWrap 0066 } 0067 } 0068 0069 onClicked: { 0070 radioButtonClick() 0071 } 0072 }