Feature: new selectors

This commit is contained in:
2026-08-27 09:39:32 +01:00
parent cede2a1690
commit 86921f7aab
4 changed files with 92 additions and 1 deletions

View File

@@ -173,6 +173,18 @@ Item {
color: toggleRoot.checked ? Colors.primary : Colors.muted color: toggleRoot.checked ? Colors.primary : Colors.muted
opacity: toggleRoot.checked ? 1 : 0.35 opacity: toggleRoot.checked ? 1 : 0.35
} }
// Hover-only outline, offset outside the switch itself rather than
// drawn on its edge — the switch lags behind a click until the
// backend confirms it (e.g. the adapter's enabled state), so this
// is just a "you can click this" cue, not click feedback.
Rectangle {
anchors.fill: parent
anchors.margins: -4
radius: 0
color: "transparent"
border.color: Colors.foreground
border.width: toggleMouse.containsMouse ? 1 : 0
}
Rectangle { Rectangle {
width: parent.height - 4 width: parent.height - 4
height: parent.height - 4 height: parent.height - 4
@@ -183,7 +195,9 @@ Item {
Behavior on x { NumberAnimation { duration: Appearance.animationDuration } } Behavior on x { NumberAnimation { duration: Appearance.animationDuration } }
} }
MouseArea { MouseArea {
id: toggleMouse
anchors.fill: parent anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: toggleRoot.toggled() onClicked: toggleRoot.toggled()
} }

View File

@@ -601,6 +601,18 @@ Item {
color: toggleRoot.checked ? Colors.primary : Colors.muted color: toggleRoot.checked ? Colors.primary : Colors.muted
opacity: toggleRoot.checked ? 1 : 0.35 opacity: toggleRoot.checked ? 1 : 0.35
} }
// Hover-only outline, offset outside the switch itself rather than
// drawn on its edge — the switch lags behind a click until the
// backend confirms it (e.g. Networking.wifiEnabled), so this is just
// a "you can click this" cue, not click feedback.
Rectangle {
anchors.fill: parent
anchors.margins: -4
radius: 0
color: "transparent"
border.color: Colors.foreground
border.width: toggleMouse.containsMouse ? 1 : 0
}
Rectangle { Rectangle {
width: parent.height - 4 width: parent.height - 4
height: parent.height - 4 height: parent.height - 4
@@ -611,7 +623,9 @@ Item {
Behavior on x { NumberAnimation { duration: Appearance.animationDuration } } Behavior on x { NumberAnimation { duration: Appearance.animationDuration } }
} }
MouseArea { MouseArea {
id: toggleMouse
anchors.fill: parent anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: toggleRoot.toggled() onClicked: toggleRoot.toggled()
} }
@@ -631,6 +645,22 @@ Item {
color: (netRow.net.connected || netRow.passwordOpen) color: (netRow.net.connected || netRow.passwordOpen)
? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18) ? Qt.rgba(Colors.primary.r, Colors.primary.g, Colors.primary.b, 0.18)
: (rowMouse.containsMouse ? Colors.primary : "transparent") : (rowMouse.containsMouse ? Colors.primary : "transparent")
border.color: (netRow.net.connected || netRow.passwordOpen) ? Colors.primary : Colors.muted
border.width: 1
// Hover-only outline, offset outside the row rather than drawn on
// its own edge — same treatment as ToggleSwitch's halo and the DNS
// pills. networkListColumn insets its rows by 3px on each side
// specifically to give this room without getting cropped by the
// Flickable's clip.
Rectangle {
anchors.fill: parent
anchors.margins: -3
radius: 0
color: "transparent"
border.color: Colors.foreground
border.width: rowMouse.containsMouse ? 1 : 0
}
Column { Column {
anchors.fill: parent anchors.fill: parent
@@ -872,6 +902,18 @@ Item {
border.width: 1 border.width: 1
opacity: root.dnsBusy ? 0.6 : 1 opacity: root.dnsBusy ? 0.6 : 1
// Hover-only outline, offset outside the pill
// itself rather than drawn on its own border —
// same treatment as ToggleSwitch's halo.
Rectangle {
anchors.fill: parent
anchors.margins: -3
radius: 0
color: "transparent"
border.color: Colors.foreground
border.width: dnsMouse.containsMouse ? 1 : 0
}
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
text: dnsPill.modelData text: dnsPill.modelData
@@ -1164,7 +1206,12 @@ Item {
Column { Column {
id: networkListColumn id: networkListColumn
width: networkListFlick.width // Inset 3px on each side (rather than flush with
// the Flickable) so NetworkRow's hover halo below
// has room to sit outside the row without being
// cropped by the Flickable's own clip.
x: 3
width: networkListFlick.width - 6
spacing: 6 spacing: 6
Column { Column {

View File

@@ -505,6 +505,18 @@ Item {
color: toggleRoot.checked ? Colors.primary : Colors.muted color: toggleRoot.checked ? Colors.primary : Colors.muted
opacity: toggleRoot.checked ? 1 : 0.35 opacity: toggleRoot.checked ? 1 : 0.35
} }
// Hover-only outline, offset outside the switch itself rather than
// drawn on its edge — the switch lags behind a click until the
// backend confirms it (e.g. root.active), so this is just a "you
// can click this" cue, not click feedback.
Rectangle {
anchors.fill: parent
anchors.margins: -4
radius: 0
color: "transparent"
border.color: Colors.foreground
border.width: toggleMouse.containsMouse ? 1 : 0
}
Rectangle { Rectangle {
width: parent.height - 4 width: parent.height - 4
height: parent.height - 4 height: parent.height - 4
@@ -515,7 +527,9 @@ Item {
Behavior on x { NumberAnimation { duration: Appearance.animationDuration } } Behavior on x { NumberAnimation { duration: Appearance.animationDuration } }
} }
MouseArea { MouseArea {
id: toggleMouse
anchors.fill: parent anchors.fill: parent
hoverEnabled: true
cursorShape: Qt.PointingHandCursor cursorShape: Qt.PointingHandCursor
onClicked: toggleRoot.toggled() onClicked: toggleRoot.toggled()
} }

View File

@@ -373,6 +373,20 @@ Item {
color: toggleRoot.checked ? Colors.primary : Colors.muted color: toggleRoot.checked ? Colors.primary : Colors.muted
opacity: (toggleRoot.checked ? 1 : 0.35) * (toggleRoot.busy ? 0.6 : 1) opacity: (toggleRoot.checked ? 1 : 0.35) * (toggleRoot.busy ? 0.6 : 1)
} }
// Hover-only outline, offset outside the switch itself rather than
// drawn on its edge — the switch lags behind a click until the
// connect/disconnect process actually finishes, so this is just a
// "you can click this" cue, not click feedback. toggleMouse.containsMouse
// is already false while busy, since a disabled MouseArea doesn't
// track hover.
Rectangle {
anchors.fill: parent
anchors.margins: -4
radius: 0
color: "transparent"
border.color: Colors.foreground
border.width: toggleMouse.containsMouse ? 1 : 0
}
Rectangle { Rectangle {
width: parent.height - 4 width: parent.height - 4
height: parent.height - 4 height: parent.height - 4
@@ -383,8 +397,10 @@ Item {
Behavior on x { NumberAnimation { duration: Appearance.animationDuration } } Behavior on x { NumberAnimation { duration: Appearance.animationDuration } }
} }
MouseArea { MouseArea {
id: toggleMouse
anchors.fill: parent anchors.fill: parent
enabled: !toggleRoot.busy enabled: !toggleRoot.busy
hoverEnabled: true
cursorShape: toggleRoot.busy ? Qt.ArrowCursor : Qt.PointingHandCursor cursorShape: toggleRoot.busy ? Qt.ArrowCursor : Qt.PointingHandCursor
onClicked: toggleRoot.toggled() onClicked: toggleRoot.toggled()
} }