fix(myqbz): centre the detail ToolBtn glyph (Filter / Select)
The ToolBtn row used an absolute `x: 8/10px` offset together with `width: preferred + padding`, which pushed the icon (and label) off-centre — the Filter and Select buttons read as misaligned. Replace the x offset with symmetric padding-left/right inside the HorizontalLayout and size the button to the layout's natural width, so the glyph is centred deterministically. cc
This commit is contained in:
1 file changed
+6
-2
@@ -95,14 +95,18 @@ component ToolBtn inherits Rectangle {
|
|||||||
callback clicked();
|
callback clicked();
|
||||||
height: 30px;
|
height: 30px;
|
||||||
border-radius: 6px;
|
border-radius: 6px;
|
||||||
width: row.preferred-width + (root.label == "" ? 16px : 20px);
|
// Width = the layout's natural size (its own symmetric padding included), so
|
||||||
|
// the content is centred by the padding rather than an absolute x offset that
|
||||||
|
// fought the width and pushed the glyph off-centre.
|
||||||
|
width: row.preferred-width;
|
||||||
background: (root.active && root.fill-active)
|
background: (root.active && root.fill-active)
|
||||||
? Theme.accent
|
? Theme.accent
|
||||||
: (cb-ta.has-hover ? Theme.surface-hover : Theme.surface-elevated);
|
: (cb-ta.has-hover ? Theme.surface-hover : Theme.surface-elevated);
|
||||||
border-width: 1px;
|
border-width: 1px;
|
||||||
border-color: (root.active && !root.fill-active) ? Theme.accent : Theme.border-subtle;
|
border-color: (root.active && !root.fill-active) ? Theme.accent : Theme.border-subtle;
|
||||||
row := HorizontalLayout {
|
row := HorizontalLayout {
|
||||||
x: root.label == "" ? 8px : 10px;
|
padding-left: root.label == "" ? 8px : 10px;
|
||||||
|
padding-right: root.label == "" ? 8px : 10px;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
spacing: 6px;
|
spacing: 6px;
|
||||||
alignment: center;
|
alignment: center;
|
||||||
|
|||||||
Reference in new issue
Block a user