fix(ui): tách hàng Cài đặt khỏi nhóm menu ngay trên nó

Thanh rail đặt setSpacing(0) nên nút Cài đặt dán sát Dashboard/Giám sát, ba
dòng đọc thành một khối. Thêm hằng _NAV_SETTINGS_GAP trong rail_metrics và
xin khe bằng nvl.addSpacing() — margin trong QSS vẽ BÊN TRONG hộp widget, mà
nút này bị _rebuild_nav ghim đúng chiều cao một dòng menu nên margin không
mua được pixel nào.

Rút gọn lại comment ở _rebuild_nav cho khớp.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-09-10 01:35:47 +09:00
committed by thanhnv
co-authored by Claude Opus 5
parent 3c3ec748f9
commit aeecdf5da0
3 changed files with 18 additions and 14 deletions
+6 -13
View File
@@ -251,24 +251,17 @@ class NavRailMixin:
blocked = tree.blockSignals(True)
tree.addTopLevelItem(it)
tree.blockSignals(blocked)
# Both destination lists are exactly as tall as their rows; the
# stretch in between belongs to RECENTS.
#
# The frame, and nothing else. A flat ``+ 8`` here used to leave 6px
# of dead space under the last row of each list, and because the
# Settings button sits DIRECTLY under nav_bottom (nvl has no
# spacing), that space landed between Giám sát and Settings only —
# so three rows that read as one list were spaced 18/26px. Padding
# a row is the item delegate's job; this is the frame's.
# Rows plus frame, nothing else: the flat ``+ 8`` this replaces
# left 6px of dead space under the last row, and since Settings
# sits directly under nav_bottom it fell between Giám sát and
# Settings alone — 18/26px for rows that read as one list.
row_h = 0
for tree in (self.nav, self.nav_bottom):
n = tree.topLevelItemCount()
row_h = tree.sizeHintForRow(0) if n else row_h
tree.setFixedHeight(n * row_h + 2 * tree.frameWidth())
# Settings is one more row of the same list, so it gets the rows'
# own height rather than a second set of paddings guessed to match
# it — the only way the three stay evenly spaced when the font (and
# with it ``sizeHintForRow``) is not the one this was tuned on.
# Settings is one more row of the list, so it takes the rows' own
# height instead of paddings guessed to match it.
if row_h and hasattr(self, "_nav_settings_btn"):
self._nav_settings_btn.setFixedHeight(row_h)
if keep: