mirror of
https://github.com/fergalmoran/picard.git
synced 2026-03-01 02:54:01 +00:00
Save table header size on each resize
The ResultTable is resized using size information from config.setting["searchdialog_header_state"]. As this value is updated only when the dialog is closed, any ongoing changes (i.e. without closing the dialog) will be ignored. This patch avoids that.
This commit is contained in:
@@ -45,14 +45,12 @@ class ResultTable(QtGui.QTableWidget):
|
||||
QtGui.QAbstractItemView.SelectRows)
|
||||
self.setEditTriggers(
|
||||
QtGui.QAbstractItemView.NoEditTriggers)
|
||||
|
||||
self.horizontalHeader().setStretchLastSection(True)
|
||||
self.horizontalHeader().setResizeMode(
|
||||
QtGui.QHeaderView.Stretch)
|
||||
self.horizontalHeader().setResizeMode(
|
||||
QtGui.QHeaderView.Interactive)
|
||||
|
||||
|
||||
class SearchBox(QtGui.QWidget):
|
||||
|
||||
def __init__(self, parent):
|
||||
@@ -198,6 +196,8 @@ class SearchDialog(PicardDialog):
|
||||
self.table = ResultTable(self.table_headers)
|
||||
self.table.setObjectName("results_table")
|
||||
self.table.cellDoubleClicked.connect(self.row_double_clicked)
|
||||
self.table.horizontalHeader().sectionResized.connect(
|
||||
self.save_table_header_state)
|
||||
self.restore_table_header_state()
|
||||
self.add_widget_to_center_layout(self.table)
|
||||
def enable_loading_button():
|
||||
@@ -244,11 +244,14 @@ class SearchDialog(PicardDialog):
|
||||
|
||||
def save_state(self, table_loaded=True):
|
||||
if table_loaded:
|
||||
header = self.table.horizontalHeader()
|
||||
config.persist["searchdialog_header_state"] = header.saveState()
|
||||
self.save_table_header_state()
|
||||
config.persist["searchdialog_window_size"] = self.size()
|
||||
self.search_box.save_checkbox_state()
|
||||
|
||||
def save_table_header_state(self):
|
||||
state = self.table.horizontalHeader().saveState()
|
||||
config.persist["searchdialog_header_state"] = state
|
||||
|
||||
|
||||
class TrackSearchDialog(SearchDialog):
|
||||
|
||||
|
||||
Reference in New Issue
Block a user