fix(repository): stretch the Value column in Setting history dialog

The dialog stretched the middle "Setting" column, leaving "Value" stuck at
the ~100px default with no draggable handle (it's the last column next to a
stretch section). Switch to the codebase convention used by the sibling
da12 history dialog: stretch the last column ("Value"), keep sections
Interactive (resizable), and resizeColumnsToContents for sensible initial
widths. Value now fills the space, Setting fits its label, columns resize.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-06 10:48:41 -04:00
parent db3519da01
commit 1219517d14
2 changed files with 22 additions and 4 deletions

View File

@@ -12,7 +12,6 @@ from PySide6.QtWidgets import (
QDialog,
QFileDialog,
QHBoxLayout,
QHeaderView,
QLineEdit,
QPushButton,
QTableWidget,
@@ -56,12 +55,16 @@ class SettingHistoryDialog(QDialog):
self.table.setHorizontalHeaderLabels(_HEADERS)
self.table.setEditTriggers(QAbstractItemView.EditTrigger.NoEditTriggers)
self.table.setSelectionBehavior(QAbstractItemView.SelectionBehavior.SelectRows)
self.table.horizontalHeader().setSectionResizeMode(
1, QHeaderView.ResizeMode.Stretch
)
# Sections stay Interactive (user-resizable); the last column ("Value")
# stretches to fill the remaining width — it's the field being inspected,
# so it gets the room, not the middle "Setting" column.
self.table.horizontalHeader().setStretchLastSection(True)
layout.addWidget(self.table)
self._populate(self._rows)
# Fit Timestamp/Setting to their content for a sensible initial layout;
# the stretched "Value" column then fills whatever space is left.
self.table.resizeColumnsToContents()
def _populate(self, rows) -> None:
self._shown = list(rows) # what's on screen now; export mirrors this

View File

@@ -55,6 +55,21 @@ def test_dialog_exports_current_rows_to_xlsx(qtbot, tmp_path):
assert out.exists() and out.stat().st_size > 0
def test_value_column_fills_space_and_columns_are_resizable(qtbot):
from PySide6.QtWidgets import QHeaderView
repo = _repo_with_rows()
dlg = SettingHistoryDialog(repo, "MAC1")
qtbot.addWidget(dlg)
header = dlg.table.horizontalHeader()
# The last column ("Value") fills remaining width — NOT the middle "Setting".
assert header.stretchLastSection() is True
assert header.sectionResizeMode(1) != QHeaderView.ResizeMode.Stretch
# Columns stay user-resizable (Interactive), so a long value can be widened.
assert header.sectionResizeMode(0) == QHeaderView.ResizeMode.Interactive
assert header.sectionResizeMode(1) == QHeaderView.ResizeMode.Interactive
def test_export_mirrors_active_filter(qtbot):
repo = _repo_with_rows()
dlg = SettingHistoryDialog(repo, "MAC1")