linphone-desktop/Linphone/view/Control/Button/RadioButton.qml
2025-10-23 12:39:16 +02:00

60 lines
1.6 KiB
QML

import QtQuick
import QtQuick.Controls.Basic as Control
import QtQuick.Layouts
import QtQuick.Effects
import Linphone
import "qrc:/qt/qml/Linphone/view/Control/Tool/Helper/utils.js" as Utils
Control.RadioButton {
id: mainItem
property string title
property string contentText
property string imgUrl
property bool checkOnClick: true
property color color
property real indicatorSize: Utils.getSizeWithScreenRatio(16)
property bool shadowEnabled: mainItem.activeFocus || mainItem.hovered
//onClicked: if (checkOnClick && !mainItem.checked) mainItem.toggle()
MouseArea{
id: mouseArea
anchors.fill:parent
hoverEnabled: true
acceptedButtons: Qt.NoButton
cursorShape: containsMouse ? Qt.PointingHandCursor : Qt.ArrowCursor
}
indicator: Item {
implicitWidth: mainItem.indicatorSize
implicitHeight: mainItem.indicatorSize
anchors.verticalCenter: mainItem.verticalCenter
Rectangle {
id: backgroundArea
anchors.fill: parent
radius: mainItem.indicatorSize/2
color: "transparent"
border.color: mainItem.color
border.width: Utils.getSizeWithScreenRatio(2)
Rectangle {
width: parent.width/2
height: parent.height/2
x: parent.width/4
y: parent.width/4
radius: width/2
color: mainItem.color
visible: mainItem.checked
}
}
MultiEffect {
enabled: mainItem.shadowEnabled
anchors.fill: backgroundArea
source: backgroundArea
visible: mainItem.shadowEnabled
// Crash : https://bugreports.qt.io/browse/QTBUG-124730
shadowEnabled: true //mainItem.shadowEnabled
shadowColor: DefaultStyle.grey_1000
shadowBlur: 0.1
shadowOpacity: mainItem.shadowEnabled ? 0.5 : 0.0
}
}
}