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>
58 lines
1.8 KiB
QML
58 lines
1.8 KiB
QML
import QtQuick 6.8 // 6.12 added a QtQuick Color singleton that hides Commons.Color
|
|
import qs.compat.omarchy.Commons
|
|
Item {
|
|
id: root
|
|
|
|
property string text: ""
|
|
property string fontFamily: Style.font.family
|
|
property real fontSize: Style.font.body
|
|
property color color: Color.foreground
|
|
property bool debugBounds: false
|
|
|
|
readonly property int renderedFontSize: Math.max(1, Math.round(fontSize))
|
|
readonly property real tightWidth: Math.max(1, glyphMetrics.tightBoundingRect.width)
|
|
readonly property real horizontalCorrection: glyph.implicitWidth / 2 - (glyphMetrics.tightBoundingRect.x + tightWidth / 2)
|
|
readonly property real paintedCenterX: glyph.x + glyphMetrics.tightBoundingRect.x + tightWidth / 2
|
|
readonly property real baselineY: glyph.y + glyph.baselineOffset
|
|
|
|
TextMetrics {
|
|
id: glyphMetrics
|
|
font.family: root.fontFamily
|
|
font.pixelSize: root.renderedFontSize
|
|
text: root.text
|
|
}
|
|
|
|
Text {
|
|
id: glyph
|
|
textFormat: Text.PlainText
|
|
// Keep the shared line box and baseline intact. Correcting only the
|
|
// horizontal painted bounds avoids per-glyph vertical drift.
|
|
// The correction is fractional, so x is set exactly: centerIn would snap it
|
|
// to a whole pixel and undo it. y still snaps, keeping the baseline crisp.
|
|
x: (root.width - width) / 2 + root.horizontalCorrection
|
|
y: Math.round((root.height - height) / 2)
|
|
text: root.text
|
|
color: root.color
|
|
font.family: root.fontFamily
|
|
font.pixelSize: root.renderedFontSize
|
|
renderType: Text.NativeRendering
|
|
}
|
|
|
|
Rectangle {
|
|
visible: root.debugBounds
|
|
anchors.fill: parent
|
|
color: "transparent"
|
|
border.width: 1
|
|
border.color: "#4488ff"
|
|
}
|
|
|
|
Rectangle {
|
|
visible: root.debugBounds
|
|
x: 0
|
|
y: Math.round(root.baselineY)
|
|
width: parent.width
|
|
height: 1
|
|
color: "#44ff88"
|
|
}
|
|
}
|