Skip to content
Snippets Groups Projects
Unverified Commit 581f6abf authored by Gagik Vardanyan's avatar Gagik Vardanyan Committed by GitHub
Browse files

Merge pull request #24502 from mantidproject/24388_make_columns_adjustable

Columns in Matrix and Table workspace displays are now adjustable
parents 275acc03 fd1bd342
No related branches found
No related tags found
No related merge requests found
......@@ -20,6 +20,23 @@ import mantidqt.icons
from mantidqt.widgets.matrixworkspacedisplay.table_view_model import MatrixWorkspaceTableViewModelType
class MatrixWorkspaceTableView(QTableView):
def __init__(self, parent):
super(MatrixWorkspaceTableView, self).__init__(parent)
self.setSelectionBehavior(QAbstractItemView.SelectItems)
header = self.horizontalHeader()
header.sectionDoubleClicked.connect(self.handle_double_click)
def resizeEvent(self, _):
header = self.horizontalHeader()
header.setSectionResizeMode(QHeaderView.Interactive)
def handle_double_click(self, section):
header = self.horizontalHeader()
header.resizeSection(section, header.defaultSectionSize())
class MatrixWorkspaceDisplayView(QTabWidget):
def __init__(self, presenter, parent=None, name=''):
super(MatrixWorkspaceDisplayView, self).__init__(parent)
......@@ -51,8 +68,8 @@ class MatrixWorkspaceDisplayView(QTabWidget):
self.show()
def add_table(self, label):
tab = QTableView()
tab.setSelectionBehavior(QAbstractItemView.SelectItems)
tab = MatrixWorkspaceTableView(self)
self.addTab(tab, label)
self.tabs.append(tab)
return tab
......
......@@ -57,6 +57,17 @@ class TableWorkspaceDisplayView(QTableWidget):
self.resize(600, 400)
self.show()
header = self.horizontalHeader()
header.sectionDoubleClicked.connect(self.handle_double_click)
def resizeEvent(self, _):
header = self.horizontalHeader()
header.setSectionResizeMode(QHeaderView.Interactive)
def handle_double_click(self, section):
header = self.horizontalHeader()
header.resizeSection(section, header.defaultSectionSize())
def keyPressEvent(self, event):
if event.matches(QKeySequence.Copy):
self.presenter.action_keypress_copy()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment