Qt 6.12's QtQuick exports a Color singleton, which hides the Omarchy and Noctalia kits' Commons.Color: every Color.foreground read undefined, so plugin buttons, toggles and text fell back to black. The kits now import QtQuick 6.8, which predates it, and the installer pins the same version in plugin files that use Color (reinstall plugins to pick it up). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
67 lines
1.7 KiB
QML
67 lines
1.7 KiB
QML
import QtQuick 6.8 // 6.12 added a QtQuick Color singleton that hides Commons.Color
|
|
import qs.compat.noctalia.Commons
|
|
|
|
Item {
|
|
id: root
|
|
|
|
property bool running: true
|
|
property color color: Color.mPrimary
|
|
property int size: Style.baseWidgetSize
|
|
property int strokeWidth: Style.borderL
|
|
property int duration: Style.animationSlow * 2
|
|
|
|
implicitWidth: size
|
|
implicitHeight: size
|
|
|
|
onColorChanged: canvas.requestPaint()
|
|
|
|
// GPU-optimized spinner - draw once, rotate with GPU transform
|
|
Item {
|
|
id: spinner
|
|
anchors.fill: parent
|
|
|
|
// Static canvas - drawn ONCE, then cached
|
|
Canvas {
|
|
id: canvas
|
|
anchors.fill: parent
|
|
renderStrategy: Canvas.Cooperative // Better performance than Threaded for simple shapes
|
|
renderTarget: Canvas.FramebufferObject // GPU texture
|
|
|
|
// Enable layer caching - critical for performance!
|
|
layer.enabled: true
|
|
layer.smooth: true
|
|
|
|
Component.onCompleted: {
|
|
requestPaint();
|
|
}
|
|
|
|
onPaint: {
|
|
var ctx = getContext("2d");
|
|
ctx.reset();
|
|
|
|
var centerX = width / 2;
|
|
var centerY = height / 2;
|
|
var radius = Math.min(width, height) / 2 - strokeWidth / 2;
|
|
|
|
ctx.strokeStyle = root.color;
|
|
ctx.lineWidth = Math.max(1, root.strokeWidth);
|
|
ctx.lineCap = "round";
|
|
|
|
// Draw arc with gap (270 degrees = 3/4 of circle)
|
|
ctx.beginPath();
|
|
ctx.arc(centerX, centerY, radius, -Math.PI / 2, -Math.PI / 2 + Math.PI * 1.5);
|
|
ctx.stroke();
|
|
}
|
|
}
|
|
|
|
// Smooth rotation animation - uses GPU transform, NO canvas repaints!
|
|
RotationAnimation on rotation {
|
|
running: root.running
|
|
from: 0
|
|
to: 360
|
|
duration: root.duration
|
|
loops: Animation.Infinite
|
|
}
|
|
}
|
|
}
|