diff --git a/Components/Anim.qml b/Components/Anim.qml index c32e713..5012c01 100644 --- a/Components/Anim.qml +++ b/Components/Anim.qml @@ -1,5 +1,4 @@ import QtQuick -import qs.Modules import qs.Config NumberAnimation { diff --git a/Components/CAnim.qml b/Components/CAnim.qml index 09b33b1..59acb22 100644 --- a/Components/CAnim.qml +++ b/Components/CAnim.qml @@ -1,5 +1,4 @@ import QtQuick -import qs.Modules import qs.Config ColorAnimation { diff --git a/Components/CircularIndicator.qml b/Components/CircularIndicator.qml index c398d48..b17ad12 100644 --- a/Components/CircularIndicator.qml +++ b/Components/CircularIndicator.qml @@ -1,6 +1,4 @@ -import qs.Helpers import qs.Config -import qs.Modules import ZShell.Internal import QtQuick import QtQuick.Templates diff --git a/Components/CircularProgress.qml b/Components/CircularProgress.qml index ef98fd6..da6d78f 100644 --- a/Components/CircularProgress.qml +++ b/Components/CircularProgress.qml @@ -1,8 +1,6 @@ import QtQuick import QtQuick.Shapes -import qs.Helpers import qs.Config -import qs.Modules Shape { id: root diff --git a/Components/Coloriser.qml b/Components/Coloriser.qml index f0212f1..96f6c5c 100644 --- a/Components/Coloriser.qml +++ b/Components/Coloriser.qml @@ -1,6 +1,5 @@ import QtQuick import QtQuick.Effects -import qs.Modules MultiEffect { property color sourceColor: "black" diff --git a/Components/CustomAudioSlider.qml b/Components/CustomAudioSlider.qml index 8a74a29..33b1a47 100644 --- a/Components/CustomAudioSlider.qml +++ b/Components/CustomAudioSlider.qml @@ -1,7 +1,6 @@ import QtQuick import QtQuick.Templates import qs.Config -import qs.Modules Slider { id: root diff --git a/Components/CustomClippingRect.qml b/Components/CustomClippingRect.qml index 120b117..8f2630c 100644 --- a/Components/CustomClippingRect.qml +++ b/Components/CustomClippingRect.qml @@ -1,6 +1,5 @@ import Quickshell.Widgets import QtQuick -import qs.Modules ClippingRectangle { id: root diff --git a/Components/CustomFlickable.qml b/Components/CustomFlickable.qml index 05ba9a8..788a1bb 100644 --- a/Components/CustomFlickable.qml +++ b/Components/CustomFlickable.qml @@ -1,5 +1,4 @@ import QtQuick -import qs.Modules Flickable { id: root diff --git a/Components/CustomListView.qml b/Components/CustomListView.qml index e570513..02ad4b3 100644 --- a/Components/CustomListView.qml +++ b/Components/CustomListView.qml @@ -1,6 +1,4 @@ import QtQuick -import qs.Config -import qs.Modules ListView { id: root diff --git a/Components/CustomRadioButton.qml b/Components/CustomRadioButton.qml index cfaa64c..62be723 100644 --- a/Components/CustomRadioButton.qml +++ b/Components/CustomRadioButton.qml @@ -1,7 +1,6 @@ import QtQuick import QtQuick.Templates import qs.Config -import qs.Modules RadioButton { id: root diff --git a/Components/CustomRect.qml b/Components/CustomRect.qml index 0aba620..f5d5143 100644 --- a/Components/CustomRect.qml +++ b/Components/CustomRect.qml @@ -1,5 +1,4 @@ import QtQuick -import qs.Modules Rectangle { id: root diff --git a/Components/CustomScrollBar.qml b/Components/CustomScrollBar.qml index d57cc43..68173d1 100644 --- a/Components/CustomScrollBar.qml +++ b/Components/CustomScrollBar.qml @@ -1,5 +1,4 @@ import qs.Config -import qs.Modules import QtQuick import QtQuick.Templates diff --git a/Components/CustomSlider.qml b/Components/CustomSlider.qml index 5f21e71..8845747 100644 --- a/Components/CustomSlider.qml +++ b/Components/CustomSlider.qml @@ -1,7 +1,6 @@ import QtQuick import QtQuick.Templates import qs.Config -import qs.Modules Slider { id: root diff --git a/Components/CustomSwitch.qml b/Components/CustomSwitch.qml index 83de2dd..260f6fe 100644 --- a/Components/CustomSwitch.qml +++ b/Components/CustomSwitch.qml @@ -1,8 +1,7 @@ -import qs.Config -import qs.Modules import QtQuick import QtQuick.Templates import QtQuick.Shapes +import qs.Config Switch { id: root @@ -42,6 +41,91 @@ Switch { } } + Shape { + id: icon + + property point start1: { + if (root.pressed) + return Qt.point(width * 0.1, height / 2); + if (root.checked) + return Qt.point(width * 0.15, height / 2); + return Qt.point(width * 0.15, height * 0.15); + } + property point end1: { + if (root.pressed) { + if (root.checked) + return Qt.point(width * 0.4, height / 2); + return Qt.point(width * 0.8, height / 2); + } + if (root.checked) + return Qt.point(width * 0.4, height * 0.7); + return Qt.point(width * 0.85, height * 0.85); + } + property point start2: { + if (root.pressed) { + if (root.checked) + return Qt.point(width * 0.4, height / 2); + return Qt.point(width * 0.2, height / 2); + } + if (root.checked) + return Qt.point(width * 0.4, height * 0.7); + return Qt.point(width * 0.15, height * 0.85); + } + property point end2: { + if (root.pressed) + return Qt.point(width, height / 2); + if (root.checked) + return Qt.point(width * 0.85, height * 0.2); + return Qt.point(width * 0.85, height * 0.15); + } + + anchors.centerIn: parent + width: height + height: parent.implicitHeight - Appearance.padding.small * 2 + preferredRendererType: Shape.CurveRenderer + asynchronous: true + + ShapePath { + strokeWidth: Appearance.font.size.larger * 0.15 + strokeColor: root.checked ? DynamicColors.palette.m3primary : DynamicColors.palette.m3surfaceContainerHighest + fillColor: "transparent" + capStyle: Appearance.rounding.scale === 0 ? ShapePath.SquareCap : ShapePath.RoundCap + + startX: icon.start1.x + startY: icon.start1.y + + PathLine { + x: icon.end1.x + y: icon.end1.y + } + PathMove { + x: icon.start2.x + y: icon.start2.y + } + PathLine { + x: icon.end2.x + y: icon.end2.y + } + + Behavior on strokeColor { + CAnim {} + } + } + + Behavior on start1 { + PropAnim {} + } + Behavior on end1 { + PropAnim {} + } + Behavior on start2 { + PropAnim {} + } + Behavior on end2 { + PropAnim {} + } + } + Behavior on x { Anim {} } diff --git a/Components/CustomText.qml b/Components/CustomText.qml index 4b30529..79bf8f4 100644 --- a/Components/CustomText.qml +++ b/Components/CustomText.qml @@ -2,7 +2,6 @@ pragma ComponentBehavior: Bound import QtQuick import qs.Config -import qs.Modules Text { id: root diff --git a/Components/CustomTextField.qml b/Components/CustomTextField.qml index b739901..fa755f4 100644 --- a/Components/CustomTextField.qml +++ b/Components/CustomTextField.qml @@ -2,9 +2,7 @@ pragma ComponentBehavior: Bound import QtQuick import QtQuick.Controls -import qs.Helpers import qs.Config -import qs.Modules TextField { id: root diff --git a/Components/CustomTooltipContent.qml b/Components/CustomTooltipContent.qml index 6a399cb..f3a4ebe 100644 --- a/Components/CustomTooltipContent.qml +++ b/Components/CustomTooltipContent.qml @@ -1,6 +1,5 @@ import QtQuick import qs.Components -import qs.Modules import qs.Config Item { diff --git a/Components/Elevation.qml b/Components/Elevation.qml index 83f9639..6c655ef 100644 --- a/Components/Elevation.qml +++ b/Components/Elevation.qml @@ -1,5 +1,4 @@ import qs.Config -import qs.Modules import QtQuick import QtQuick.Effects diff --git a/Components/ExtraIndicator.qml b/Components/ExtraIndicator.qml index e67c284..de333c0 100644 --- a/Components/ExtraIndicator.qml +++ b/Components/ExtraIndicator.qml @@ -1,5 +1,4 @@ import qs.Config -import qs.Modules import QtQuick CustomRect { diff --git a/Components/FilledSlider.qml b/Components/FilledSlider.qml index f5d3615..215be7f 100644 --- a/Components/FilledSlider.qml +++ b/Components/FilledSlider.qml @@ -1,8 +1,6 @@ import QtQuick import QtQuick.Templates -import qs.Helpers import qs.Config -import qs.Modules Slider { id: root diff --git a/Components/IconButton.qml b/Components/IconButton.qml index 6bbc64c..d0baa18 100644 --- a/Components/IconButton.qml +++ b/Components/IconButton.qml @@ -1,5 +1,4 @@ import qs.Config -import qs.Modules import QtQuick CustomRect { diff --git a/Components/StateLayer.qml b/Components/StateLayer.qml index 6b58449..af08aaf 100644 --- a/Components/StateLayer.qml +++ b/Components/StateLayer.qml @@ -1,5 +1,4 @@ import qs.Config -import qs.Modules import QtQuick MouseArea { diff --git a/Components/Toast/ToastItem.qml b/Components/Toast/ToastItem.qml index a245813..77d09d9 100644 --- a/Components/Toast/ToastItem.qml +++ b/Components/Toast/ToastItem.qml @@ -1,9 +1,7 @@ import ZShell import QtQuick import QtQuick.Layouts -import qs.Modules import qs.Components -import qs.Helpers import qs.Config CustomRect { diff --git a/Components/Toast/Toasts.qml b/Components/Toast/Toasts.qml index 3846166..2767d18 100644 --- a/Components/Toast/Toasts.qml +++ b/Components/Toast/Toasts.qml @@ -1,11 +1,10 @@ pragma ComponentBehavior: Bound -import qs.Components -import qs.Config -import qs.Modules import ZShell import Quickshell import QtQuick +import qs.Components +import qs.Config Item { id: root