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.
This commit is contained in:
Zoe Forbes
2026-01-31 20:41:27 -06:00
parent 6f4ac5ffb1
commit 6507dff1a1

View File

@@ -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)