From 6507dff1a110c2ccd69692105cac53475d183aee Mon Sep 17 00:00:00 2001 From: Zoe Forbes Date: Sat, 31 Jan 2026 20:41:27 -0600 Subject: [PATCH] fix(datum): fix selection table column alignment Use fixed-width columns (28px) for the type icon and remove button instead of ResizeToContents, which was sizing them to the header text width rather than the content. The 'Type' header label is removed since the narrow icon column is self-explanatory. The remove button uses setFixedSize(24,24) to sit cleanly within its fixed column. --- ztools/ztools/commands/datum_commands.py | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/ztools/ztools/commands/datum_commands.py b/ztools/ztools/commands/datum_commands.py index 1e3c6fb..14fd78e 100644 --- a/ztools/ztools/commands/datum_commands.py +++ b/ztools/ztools/commands/datum_commands.py @@ -139,17 +139,14 @@ class DatumCreatorTaskPanel: # Selection table self.sel_table = QtGui.QTableWidget() self.sel_table.setColumnCount(3) - self.sel_table.setHorizontalHeaderLabels(["Type", "Element", ""]) - self.sel_table.horizontalHeader().setStretchLastSection(False) - self.sel_table.horizontalHeader().setSectionResizeMode( - 0, QtGui.QHeaderView.ResizeToContents - ) - self.sel_table.horizontalHeader().setSectionResizeMode( - 1, QtGui.QHeaderView.Stretch - ) - self.sel_table.horizontalHeader().setSectionResizeMode( - 2, QtGui.QHeaderView.ResizeToContents - ) + self.sel_table.setHorizontalHeaderLabels(["", "Element", ""]) + header = self.sel_table.horizontalHeader() + header.setStretchLastSection(False) + header.setSectionResizeMode(0, QtGui.QHeaderView.Fixed) + header.setSectionResizeMode(1, QtGui.QHeaderView.Stretch) + header.setSectionResizeMode(2, QtGui.QHeaderView.Fixed) + header.resizeSection(0, 28) + header.resizeSection(2, 28) self.sel_table.setSelectionBehavior(QtGui.QAbstractItemView.SelectRows) self.sel_table.setEditTriggers(QtGui.QAbstractItemView.NoEditTriggers) self.sel_table.setMaximumHeight(150) @@ -340,7 +337,7 @@ class DatumCreatorTaskPanel: # Remove button remove_btn = QtGui.QPushButton("✕") - remove_btn.setMaximumWidth(30) + remove_btn.setFixedSize(24, 24) remove_btn.clicked.connect(lambda checked, row=i: self._remove_row(row)) self.sel_table.setCellWidget(i, 2, remove_btn)