100 lines
2.6 KiB
QML
100 lines
2.6 KiB
QML
import QtQuick
|
|
import QtQuick.Controls
|
|
import QtQuick.Layouts
|
|
|
|
import "TextTypes"
|
|
|
|
RadioButton {
|
|
id: root
|
|
|
|
property string hoveredColor: Qt.rgba(1, 1, 1, 0.05)
|
|
property string defaultColor: Qt.rgba(1, 1, 1, 0)
|
|
property string checkedColor: Qt.rgba(1, 1, 1, 0)
|
|
property string disabledColor: "transparent"
|
|
|
|
property string textColor: "#D7D8DB"
|
|
property string textDisabledColor: "#878B91"
|
|
|
|
property string pressedBorderColor: "#494B50"
|
|
property string checkedBorderColor: "#FBB26A"
|
|
property string defaultBodredColor: "transparent"
|
|
property string checkedDisabledBorderColor: "#84603D"
|
|
property int borderWidth: 0
|
|
|
|
implicitWidth: content.implicitWidth
|
|
implicitHeight: content.implicitHeight
|
|
|
|
indicator: Rectangle {
|
|
anchors.fill: parent
|
|
radius: 16
|
|
|
|
color: {
|
|
if (root.enabled) {
|
|
if (root.hovered) {
|
|
return root.hoveredColor
|
|
} else if (root.checked) {
|
|
return root.checkedColor
|
|
}
|
|
return root.defaultColor
|
|
} else {
|
|
return root.disabledColor
|
|
}
|
|
}
|
|
|
|
border.color: {
|
|
if (root.enabled) {
|
|
if (root.pressed) {
|
|
return root.pressedBorderColor
|
|
} else if (root.checked) {
|
|
return root.checkedBorderColor
|
|
}
|
|
return root.defaultBodredColor
|
|
} else {
|
|
if (root.checked) {
|
|
return root.checkedDisabledBorderColor
|
|
}
|
|
return root.defaultBodredColor
|
|
}
|
|
}
|
|
|
|
border.width: {
|
|
if(root.checked) {
|
|
return 1
|
|
}
|
|
return root.pressed ? 1 : 0
|
|
}
|
|
|
|
Behavior on color {
|
|
PropertyAnimation { duration: 200 }
|
|
}
|
|
Behavior on border.color {
|
|
PropertyAnimation { duration: 200 }
|
|
}
|
|
}
|
|
|
|
ColumnLayout {
|
|
id: content
|
|
anchors.fill: parent
|
|
spacing: 0
|
|
|
|
ButtonTextType {
|
|
text: root.text
|
|
color: root.enabled ? root.textColor : root.textDisabledColor
|
|
|
|
Layout.fillWidth: true
|
|
Layout.rightMargin: 24
|
|
Layout.leftMargin: 24
|
|
Layout.topMargin: 12
|
|
Layout.bottomMargin: 12
|
|
|
|
horizontalAlignment: Qt.AlignHCenter
|
|
verticalAlignment: Qt.AlignVCenter
|
|
}
|
|
}
|
|
|
|
MouseArea {
|
|
anchors.fill: parent
|
|
cursorShape: Qt.PointingHandCursor
|
|
enabled: false
|
|
}
|
|
}
|