Panel tweaks

This commit is contained in:
David Heinemeier Hansson
2026-05-18 15:30:29 +02:00
parent 0fe985b45d
commit cddc18b1cd
8 changed files with 29 additions and 24 deletions
+5 -3
View File
@@ -21,6 +21,7 @@ Rectangle {
// separately from real activeFocus. Visuals match the activeFocus look
// (foreground 2px border) so cursor and Tab focus read the same.
property bool hasCursor: false
property bool borderlessHighlight: false
property color foreground: Color.foreground
property color background: Color.background
@@ -42,11 +43,12 @@ Rectangle {
color: selected
? Qt.rgba(accent.r, accent.g, accent.b, 0.18)
: (mouse.containsMouse ? Style.hotFill : background)
: ((mouse.containsMouse || hasCursor) ? Qt.rgba(foreground.r, foreground.g, foreground.b, 0.12) : background)
border.color: selected
? accent
: (activeFocus || hasCursor ? foreground : Qt.rgba(foreground.r, foreground.g, foreground.b, 0.4))
border.width: selected ? 2 : (activeFocus || hasCursor ? 2 : 1)
: (activeFocus ? foreground : Qt.rgba(foreground.r, foreground.g, foreground.b, 0.4))
border.width: borderlessHighlight ? (activeFocus ? 2 : 0)
: (selected ? 2 : (activeFocus || hasCursor ? 2 : 1))
Behavior on color { ColorAnimation { duration: 100 } }
+2
View File
@@ -20,6 +20,8 @@ import QtQuick
PillButton {
id: root
cursorBordered: false
signal hovered(bool isHovered)
HoverHandler {
+4 -3
View File
@@ -13,11 +13,12 @@ Rectangle {
property bool current: false
property color foreground: "#cacccc"
property color fill: Qt.rgba(foreground.r, foreground.g, foreground.b, 0.18)
property color fill: Qt.rgba(foreground.r, foreground.g, foreground.b, 0.12)
property color currentFill: fill
radius: Style.cornerRadius
color: (hasCursor || current) ? fill : "transparent"
border.width: hasCursor ? 1 : 0
color: hasCursor ? fill : (current ? currentFill : "transparent")
border.width: 0
border.color: foreground
Behavior on color {
+2 -1
View File
@@ -40,6 +40,7 @@ Rectangle {
// hits them. The hot/cursor state paints its own 1px border, so changing
// this doesn't affect panel-pill visuals.
property bool bordered: false
property bool cursorBordered: true
activeFocusOnTab: focusable
Keys.onReturnPressed: if (focusable) root.clicked()
@@ -93,7 +94,7 @@ Rectangle {
: hot ? hoverBackground
: (active ? activeBackground : background)
border.width: _showFocusRing ? Style.focusBorderWidth
: hot ? 1
: hot ? (cursorBordered ? 1 : 0)
: (bordered ? 1 : 0)
border.color: _showFocusRing ? Style.focusBorderColor : foreground