switches and popouts
This commit is contained in:
+14
-12
@@ -1,6 +1,6 @@
|
||||
import QtQuick
|
||||
import QtQuick.Templates
|
||||
import QtQuick.Shapes
|
||||
import QtQuick.Templates
|
||||
import qs.Config
|
||||
|
||||
Switch {
|
||||
@@ -13,26 +13,28 @@ Switch {
|
||||
|
||||
indicator: CustomRect {
|
||||
color: root.checked && root.enabled ? DynamicColors.palette.m3primary : DynamicColors.layer(DynamicColors.palette.m3surfaceContainerHighest, root.cLayer)
|
||||
implicitHeight: 13 + 7 * 2
|
||||
implicitHeight: Appearance.font.size.medium + Appearance.padding.normal * 2
|
||||
implicitWidth: implicitHeight * 1.7
|
||||
radius: Appearance.rounding.full
|
||||
|
||||
CustomRect {
|
||||
readonly property real nonAnimWidth: root.pressed ? implicitHeight * 1.3 : implicitHeight
|
||||
readonly property real nonAnimWidth: root.pressed ? implicitHeight * 1.2 : implicitHeight
|
||||
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
color: root.checked && root.enabled ? DynamicColors.palette.m3onPrimary : DynamicColors.layer(DynamicColors.palette.m3outline, root.cLayer + 1)
|
||||
implicitHeight: parent.implicitHeight - 10
|
||||
implicitHeight: parent.implicitHeight - Appearance.padding.extraSmall
|
||||
implicitWidth: nonAnimWidth
|
||||
radius: Appearance.rounding.full
|
||||
x: root.checked ? parent.implicitWidth - nonAnimWidth - 10 / 2 : 10 / 2
|
||||
x: root.checked ? parent.implicitWidth - nonAnimWidth - Appearance.padding.extraSmall / 2 : Appearance.padding.extraSmall / 2
|
||||
|
||||
Behavior on implicitWidth {
|
||||
Anim {
|
||||
type: Anim.FastSpatial
|
||||
}
|
||||
}
|
||||
Behavior on x {
|
||||
Anim {
|
||||
type: Anim.FastSpatial
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +46,7 @@ Switch {
|
||||
|
||||
Behavior on opacity {
|
||||
Anim {
|
||||
type: Anim.DefaultEffects
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -63,14 +66,14 @@ Switch {
|
||||
}
|
||||
property point end2: {
|
||||
if (root.pressed)
|
||||
return Qt.point(width, height / 2);
|
||||
return Qt.point(width * 0.8, height / 2);
|
||||
if (root.checked)
|
||||
return Qt.point(width * 0.85, height * 0.2);
|
||||
return Qt.point(width * 0.85, height * 0.15);
|
||||
}
|
||||
property point start1: {
|
||||
if (root.pressed)
|
||||
return Qt.point(width * 0.1, height / 2);
|
||||
return Qt.point(width * 0.2, height / 2);
|
||||
if (root.checked)
|
||||
return Qt.point(width * 0.15, height / 2);
|
||||
return Qt.point(width * 0.15, height * 0.15);
|
||||
@@ -88,7 +91,7 @@ Switch {
|
||||
|
||||
anchors.centerIn: parent
|
||||
asynchronous: true
|
||||
height: parent.implicitHeight - Appearance.padding.small * 2
|
||||
height: parent.implicitHeight - Appearance.padding.larger
|
||||
preferredRendererType: Shape.CurveRenderer
|
||||
width: height
|
||||
|
||||
@@ -110,7 +113,7 @@ Switch {
|
||||
}
|
||||
|
||||
ShapePath {
|
||||
capStyle: Appearance.rounding.scale === 0 ? ShapePath.SquareCap : ShapePath.RoundCap
|
||||
capStyle: ShapePath.RoundCap
|
||||
fillColor: "transparent"
|
||||
startX: icon.start1.x
|
||||
startY: icon.start1.y
|
||||
@@ -148,8 +151,7 @@ Switch {
|
||||
}
|
||||
|
||||
component PropAnim: PropertyAnimation {
|
||||
duration: MaterialEasing.expressiveEffectsTime
|
||||
easing.bezierCurve: MaterialEasing.expressiveEffects
|
||||
easing.type: Easing.BezierSpline
|
||||
duration: Appearance.anim.durations.expressiveFastSpatial
|
||||
easing.bezierCurve: Appearance.anim.curves.expressiveFastSpatial
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user