Skip to content

Commit

Permalink
resolve #1, resolve #3
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-vdm committed Sep 17, 2023
1 parent 9b982db commit a694457
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ab_plugin_scenariolink/tables/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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):
"""
Expand Down

0 comments on commit a694457

Please sign in to comment.