aboutsummaryrefslogtreecommitdiffstats
path: root/config/quickshell/modules/common/widgets/RoundCorner.qml
diff options
context:
space:
mode:
authorJa.KooLit <85185940+JaKooLit@users.noreply.github.com>2025-07-15 23:46:48 +0900
committerGitHub <noreply@github.com>2025-07-15 23:46:48 +0900
commit71f1bc6920920f2a9337f18ceba6ebc12b276a6f (patch)
tree34431efa13460f9e716ed162355fd08c535aedc0 /config/quickshell/modules/common/widgets/RoundCorner.qml
parent7a3bd4f9fe48aad02ef8b13d3677b3bd8358252c (diff)
parent3aadb2106a26988346f34afafe8393b0ba6bdf79 (diff)
Merge branch 'development' into fix-slow-brightness
Diffstat (limited to 'config/quickshell/modules/common/widgets/RoundCorner.qml')
-rw-r--r--config/quickshell/modules/common/widgets/RoundCorner.qml64
1 files changed, 64 insertions, 0 deletions
diff --git a/config/quickshell/modules/common/widgets/RoundCorner.qml b/config/quickshell/modules/common/widgets/RoundCorner.qml
new file mode 100644
index 00000000..c9a2827a
--- /dev/null
+++ b/config/quickshell/modules/common/widgets/RoundCorner.qml
@@ -0,0 +1,64 @@
+import QtQuick 2.9
+
+Item {
+ id: root
+
+ property int size: 25
+ property color color: "#000000"
+
+ onColorChanged: {
+ canvas.requestPaint();
+ }
+
+ property QtObject cornerEnum: QtObject {
+ property int topLeft: 0
+ property int topRight: 1
+ property int bottomLeft: 2
+ property int bottomRight: 3
+ }
+
+ property int corner: cornerEnum.topLeft // Default to TopLeft
+
+ width: size
+ height: size
+
+ Canvas {
+ id: canvas
+
+ anchors.fill: parent
+ antialiasing: true
+
+ onPaint: {
+ var ctx = getContext("2d");
+ var r = root.size;
+
+ ctx.beginPath();
+ switch (root.corner) {
+ case cornerEnum.topLeft:
+ ctx.arc(r, r, r, Math.PI, 3 * Math.PI / 2);
+ ctx.lineTo(0, 0);
+ break;
+ case cornerEnum.topRight:
+ ctx.arc(0, r, r, 3 * Math.PI / 2, 2 * Math.PI);
+ ctx.lineTo(r, 0);
+ break;
+ case cornerEnum.bottomLeft:
+ ctx.arc(r, 0, r, Math.PI / 2, Math.PI);
+ ctx.lineTo(0, r);
+ break;
+ case cornerEnum.bottomRight:
+ ctx.arc(0, 0, r, 0, Math.PI / 2);
+ ctx.lineTo(r, r);
+ break;
+ }
+ ctx.closePath();
+ ctx.fillStyle = root.color;
+ ctx.fill();
+ }
+ }
+
+ Behavior on size {
+ animation: Appearance?.animation.elementMoveFast.numberAnimation.createObject(this)
+ }
+
+}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage