Gallery: replicate the panel cursor model from wifi/audio/bluetooth/monitor

This commit is contained in:
Ryan Hughes
2026-05-18 01:43:23 -04:00
parent 91a87470a2
commit b8188ce46c
3 changed files with 353 additions and 41 deletions
@@ -29,12 +29,11 @@ TextField {
// Panel-cursor flag. When true (and the field isn't already focused),
// the background paints the same accent ring as activeFocus so the
// panel's keyboard cursor lands here identically to a mouse hover.
// Emits `hovered(bool)` on pointer enter/leave so the panel can update
// its cursor state to match.
// 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
signal hovered(bool isHovered)
readonly property bool _focused: activeFocus || hasCursor
echoMode: password ? TextInput.Password : TextInput.Normal
@@ -57,8 +56,4 @@ TextField {
border.width: root._focused ? Style.focusBorderWidth : 1
radius: Style.cornerRadius
}
HoverHandler {
onHoveredChanged: root.hovered(hovered)
}
}