From a6944574c90edd1b4973a88a10a5fbb1384024eb Mon Sep 17 00:00:00 2001 From: marc-vdm Date: Sun, 17 Sep 2023 17:36:37 +0200 Subject: [PATCH] resolve #1, resolve #3 --- ab_plugin_scenariolink/tables/tables.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ab_plugin_scenariolink/tables/tables.py b/ab_plugin_scenariolink/tables/tables.py index 98428d0..9577171 100644 --- a/ab_plugin_scenariolink/tables/tables.py +++ b/ab_plugin_scenariolink/tables/tables.py @@ -26,6 +26,7 @@ def __init__(self, parent=None): # Hide the vertical header and set the selection mode self.verticalHeader().setVisible(False) self.setSelectionMode(QtWidgets.QTableView.SingleSelection) + self.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) # Set the size policy for the table self.setSizePolicy(QtWidgets.QSizePolicy( @@ -36,12 +37,17 @@ def __init__(self, parent=None): self.model = FoldsModel(parent=self) self._connect_signals() self.model.sync() + self.setColumnHidden(6, True) # hide the record column def _connect_signals(self): """Connect signals to slots.""" self.doubleClicked.connect(self.row_selected) self.model.updated.connect(self.update_proxy_model) self.model.updated.connect(self.custom_view_sizing) + self.model.updated.connect(self.update_col_width) + + def update_col_width(self): + self.resizeColumnsToContents() @Slot(QtCore.QModelIndex, name="row_selected") def row_selected(self, index) -> None: @@ -65,6 +71,7 @@ def __init__(self, parent=None): # Hide the vertical header and set the selection mode self.verticalHeader().setVisible(False) self.setSelectionMode(QtWidgets.QTableView.SingleSelection) + self.setSizeAdjustPolicy(QtWidgets.QAbstractScrollArea.AdjustToContents) # Specify the column index for the 'include' checkbox self.include_col = 0 @@ -79,6 +86,10 @@ def _connect_signals(self): self.model.updated.connect(self.update_proxy_model) self.model.updated.connect(self.custom_view_sizing) self.model.updated.connect(lambda: signals.record_ready.emit(True)) + self.model.updated.connect(self.update_col_width) + + def update_col_width(self): + self.resizeColumnsToContents() def mousePressEvent(self, e): """