From 11f3b97efce3003ae44efba483cf294e6e58c536 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Leroy=20R=C3=BCgemer?= Date: Tue, 13 Aug 2019 12:16:27 +0200 Subject: [PATCH] message column resizeable --- src/rqt_console/console_widget.py | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/src/rqt_console/console_widget.py b/src/rqt_console/console_widget.py index 68d6ac6..f247729 100644 --- a/src/rqt_console/console_widget.py +++ b/src/rqt_console/console_widget.py @@ -96,14 +96,18 @@ def __init__(self, proxy_model, rospack, minimal=False): self.setObjectName('ConsoleWidget') self.table_view.setModel(proxy_model) - self._columnwidth = (60, 100, 70, 100, 100, 100, 100) + + self._columnwidth = (60, 0, 70, 100, 100, 0, 100) + tmp = list(self._columnwidth) + tmp[1] = sum(self._columnwidth) - self.table_view.width() + self._columnwidth = tuple(tmp) for idx, width in enumerate(self._columnwidth): self.table_view.horizontalHeader().resizeSection(idx, width) try: - setSectionResizeMode = self.table_view.horizontalHeader().setSectionResizeMode # Qt5 + self.setSectionResizeMode = self.table_view.horizontalHeader().setSectionResizeMode # Qt5 except AttributeError: - setSectionResizeMode = self.table_view.horizontalHeader().setResizeMode # Qt4 - setSectionResizeMode(1, QHeaderView.Stretch) + self.setSectionResizeMode = self.table_view.horizontalHeader().setResizeMode # Qt4 + #setSectionResizeMode(1, QHeaderView.Stretch) def update_sort_indicator(logical_index, order): if logical_index == 0: @@ -689,8 +693,7 @@ def _handle_load_clicked(self, checked): if messages: self._model.insert_rows(messages) - - self._handle_pause_clicked(True) + self._handle_pause_clicked() return True @@ -744,7 +747,10 @@ def _handle_record_clicked(self): self.record_button.setVisible(False) def _handle_column_resize_clicked(self): + self.setSectionResizeMode(1, QHeaderView.Stretch) self.table_view.resizeColumnsToContents() + self.setSectionResizeMode(1, QHeaderView.Interactive) + def _delete_selected_rows(self): rowlist = []