Files
mxandClaude Opus 5.5 84c2385cfa Fix plugin colours on Qt 6.12
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>
2026-11-25 23:59:38 +01:00

57 lines
2.5 KiB
QML

import QtQuick 6.8 // 6.12 added a QtQuick Color singleton that hides Commons.Color
import QtQuick.Controls
import qs.compat.omarchy.Commons
// Single-line text input with the kit's focus + selection styling. Inherits
// from Qt Quick Controls TextField so the underlying type's API (text,
// placeholderText, accepted, editingFinished, validator, ...) is available
// to callers without re-exposing each property.
//
// Defaults bind to qs.Commons.Color so a caller with no theme overrides
// just works; foreground / accent / selectionTint can be overridden per
// instance. activeFocus and mouse hover / panel cursor use the same
// hover-cursor defaults, so text inputs match Button, Toggle, and Dropdown.
//
// Sizing is driven by font.pixelSize + verticalPadding. The default 30px
// implicitHeight fits dialog forms; inline callers (wifi's row-embedded
// passphrase prompt) drop verticalPadding to match a 22-26px row.
TextField {
id: root
property color foreground: Color.foreground
property color accent: Color.accent
property color selectionTint: Style.selectionFillFor(foreground, accent)
property bool password: false
property real horizontalPadding: Style.spacing.controlPaddingX
property real verticalPadding: Style.spacing.inputPaddingY
// Panel-cursor flag. When true (and the field isn't already focused),
// the background paints the shared hover/cursor state.
// For mouse-enter/leave the consumer reads QQC TextField's inherited
// `hovered` property (via onHoveredChanged) — we don't add a sibling
// signal because the inherited property would shadow it.
property bool hasCursor: false
readonly property bool _focused: activeFocus
readonly property bool _hot: hovered || hasCursor
readonly property var _borderSpec: Border.controlSpec(_focused ? "focus" : (_hot ? "hover-cursor" : "normal"), root.foreground, root.accent)
echoMode: password ? TextInput.Password : TextInput.Normal
font.family: Style.font.family
font.pixelSize: Style.font.body
color: foreground
selectionColor: selectionTint
selectedTextColor: foreground
placeholderTextColor: Qt.darker(foreground, 1.6)
leftPadding: horizontalPadding + Border.left(_borderSpec)
rightPadding: horizontalPadding + Border.right(_borderSpec)
topPadding: verticalPadding + Border.top(_borderSpec)
bottomPadding: verticalPadding + Border.bottom(_borderSpec)
background: BorderSurface {
color: Style.controlFill(root._focused, root._hot, root.foreground, root.accent)
borderSpec: root._borderSpec
radius: Style.cornerRadius
}
}