Fix the Linger row layout: fixed-size container, stable field
The hint slot is always reserved on the right (fixed width), the field keeps a constant width, and the row has a fixed height with everything vertically centered — the hint no longer sits at the top-right corner and the field no longer resizes when it appears. Hint text is body size like the other menu labels. Align the never-hide hint to the SpinBox center Anchoring the hint to the row container left it offset whenever the row's implicit height differed from the field's rendered height. Anchor to lingerField.field (the NumberField exposes the SpinBox) so the hint always sits exactly beside the field. Place the never-hide hint right next to the field Anchor the hint to the SpinBox's right edge with the field's own height and vertical center, so it reads as part of the control instead of a floating label at the row edge. Rebuild the Linger row as a plain RowLayout NumberField is a Column (label above the field), and anchoring the hint to its field alias left the text unanchored when the alias did not resolve, dumping it at (0,0) over the label. A RowLayout puts label, field, and hint in the flow, vertically centered by Layout.alignment — no anchors, no aliases. The field comes first, so the hint never moves it. Move the Linger label above the field, Position-style Label above (caption, bold, darkened — identical to the Dropdown label), the field pinned to the left half, and the never-hide legend on the right half via a fill-width spacer, so it appears only at 0 without moving the field.
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
|
import QtQuick.Layouts
|
||||||
import Quickshell
|
import Quickshell
|
||||||
import Quickshell.Io
|
import Quickshell.Io
|
||||||
import qs.Ui
|
import qs.Ui
|
||||||
@@ -221,18 +222,30 @@ Panel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Linger --------------------------------------------------------
|
// Linger --------------------------------------------------------
|
||||||
Item {
|
// Label above, styled exactly like Dropdown's "Position" label;
|
||||||
|
// the field takes the left half and the never-hide legend the right
|
||||||
|
// half (only while the value is 0). The spacer keeps the field fixed.
|
||||||
|
Column {
|
||||||
width: parent.width
|
width: parent.width
|
||||||
height: Math.max(lingerField.implicitHeight, lingerHint.implicitHeight)
|
spacing: Style.spacing.labelGap
|
||||||
|
|
||||||
|
Text {
|
||||||
|
text: "Linger"
|
||||||
|
color: Qt.darker(Color.popups.text, 1.4)
|
||||||
|
font.family: Style.font.family
|
||||||
|
font.pixelSize: Style.font.caption
|
||||||
|
font.bold: true
|
||||||
|
}
|
||||||
|
|
||||||
|
RowLayout {
|
||||||
|
width: parent.width
|
||||||
|
spacing: Style.spacing.md
|
||||||
|
|
||||||
NumberField {
|
NumberField {
|
||||||
id: lingerField
|
id: lingerField
|
||||||
anchors.left: parent.left
|
label: ""
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
fieldWidth: Style.space(110)
|
||||||
width: parent.width - (root.lingerMs === 0 ? lingerHint.implicitWidth + Style.spacing.md : 0)
|
Layout.preferredWidth: Style.space(110)
|
||||||
// With the "never hide" hint out, the field shrinks so both fit.
|
|
||||||
fieldWidth: root.lingerMs === 0 ? Style.space(72) : Style.spacing.numberFieldWidth
|
|
||||||
label: "Linger"
|
|
||||||
value: root.lingerMs
|
value: root.lingerMs
|
||||||
from: 0
|
from: 0
|
||||||
to: 10000
|
to: 10000
|
||||||
@@ -241,15 +254,18 @@ Panel {
|
|||||||
onModified: function(v) { root.writeConfig({ lingerMs: v }) }
|
onModified: function(v) { root.writeConfig({ lingerMs: v }) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
Layout.fillWidth: true
|
||||||
|
}
|
||||||
|
|
||||||
Text {
|
Text {
|
||||||
id: lingerHint
|
|
||||||
visible: root.lingerMs === 0
|
visible: root.lingerMs === 0
|
||||||
anchors.right: parent.right
|
|
||||||
anchors.verticalCenter: parent.verticalCenter
|
|
||||||
text: "never hide"
|
text: "never hide"
|
||||||
color: Qt.darker(Color.popups.text, 1.35)
|
color: Qt.darker(Color.popups.text, 1.35)
|
||||||
font.family: Style.font.family
|
font.family: Style.font.family
|
||||||
font.pixelSize: Style.font.caption
|
font.pixelSize: Style.font.body
|
||||||
|
Layout.alignment: Qt.AlignVCenter
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user