mirror of
https://github.com/noctalia-dev/noctalia-shell.git
synced 2026-05-11 17:08:27 +08:00
NRadioButton: New widget
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import qs.Services
|
||||
import qs.Widgets
|
||||
|
||||
RadioButton {
|
||||
id: root
|
||||
|
||||
indicator: Rectangle {
|
||||
id: outerCircle
|
||||
|
||||
implicitWidth: 20 * scaling
|
||||
implicitHeight: 20 * scaling
|
||||
radius: width * 0.5
|
||||
color: "transparent"
|
||||
border.color: root.checked ? Colors.accentPrimary : Colors.textPrimary
|
||||
border.width: 2
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
|
||||
Rectangle {
|
||||
anchors.centerIn: parent
|
||||
implicitWidth: Style.marginSmall * scaling
|
||||
implicitHeight: Style.marginSmall * scaling
|
||||
|
||||
radius: width * 0.5
|
||||
color: Qt.alpha(Colors.accentPrimary, root.checked ? 1 : 0)
|
||||
}
|
||||
|
||||
Behavior on border.color {
|
||||
ColorAnimation {
|
||||
duration: Style.animationNormal
|
||||
easing.type: Easing.InQuad
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
contentItem: NText {
|
||||
text: root.text
|
||||
font.pointSize: Style.fontSizeMedium * scaling
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
anchors.left: outerCircle.right
|
||||
anchors.leftMargin: Style.marginSmall * scaling
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user