From d75b22830313582424ff14c177f474e10003860a Mon Sep 17 00:00:00 2001 From: ila Date: Mon, 22 Jun 2026 10:08:36 +0800 Subject: [PATCH] =?UTF-8?q?fix(ai-outfit):=20stop=20combos=20from=20clippi?= =?UTF-8?q?ng=20the=20left=20column=20(=C2=A710.1)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Constrain the 样本行 and AI 模型 combos (AdjustToMinimumContentsLengthWithIcon + minimumContentsLength + Ignored size policy) so long items elide instead of inflating the column's min width. Left scroll h-policy AlwaysOff -> AsNeeded as a safety net; trim splitter initial sizes to fit the default window. Measured: left inner minimumSizeHint 829px -> 200px (viewport ~398), no clip. Co-Authored-By: Claude Opus 4.8 --- src/app/widgets/ai_outfit_panel.py | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/app/widgets/ai_outfit_panel.py b/src/app/widgets/ai_outfit_panel.py index 5b49afc..b271021 100644 --- a/src/app/widgets/ai_outfit_panel.py +++ b/src/app/widgets/ai_outfit_panel.py @@ -29,6 +29,7 @@ from PySide6.QtWidgets import ( QProgressBar, QPushButton, QScrollArea, + QSizePolicy, QSpinBox, QSplitter, QTableWidget, @@ -161,13 +162,15 @@ class AiOutfitPanel(QWidget): splitter.setStretchFactor(0, 0) splitter.setStretchFactor(1, 1) splitter.setStretchFactor(2, 0) - splitter.setSizes([430, 760, 300]) + splitter.setSizes([400, 600, 300]) outer.addWidget(splitter) def _build_left(self): scroll = QScrollArea() scroll.setWidgetResizable(True) - scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) + # AsNeeded (not AlwaysOff): if a child ever exceeds the column it scrolls + # instead of being clipped under the center panel (docs/11 §10.1). + scroll.setHorizontalScrollBarPolicy(Qt.ScrollBarAsNeeded) scroll.setMinimumWidth(360) inner = QWidget() col = QVBoxLayout(inner) @@ -190,6 +193,7 @@ class AiOutfitPanel(QWidget): ov.addLayout(self._path_row(self._output_edit, self._browse_output)) ov.addWidget(QLabel("AI 模型")) self._model_combo = QComboBox() + self._compact_combo(self._model_combo) ov.addWidget(self._model_combo) col.addWidget(out) @@ -217,6 +221,7 @@ class AiOutfitPanel(QWidget): srow = QHBoxLayout() srow.addWidget(QLabel("样本行")) self._sample_combo = QComboBox() + self._compact_combo(self._sample_combo) self._sample_combo.currentIndexChanged.connect(self._refresh_preview) srow.addWidget(self._sample_combo, stretch=1) pvw.addLayout(srow) @@ -281,6 +286,13 @@ class AiOutfitPanel(QWidget): v.addWidget(widget) return cell + def _compact_combo(self, combo): + """Keep a combo from dictating column width: elide long items instead of + expanding its minimum size hint (docs/11 §10.1).""" + combo.setSizeAdjustPolicy(QComboBox.AdjustToMinimumContentsLengthWithIcon) + combo.setMinimumContentsLength(6) + combo.setSizePolicy(QSizePolicy.Ignored, QSizePolicy.Preferred) + def _path_row(self, line_edit, on_browse): row = QHBoxLayout() row.addWidget(line_edit, stretch=1)