From eac2e2ad0b6d7c65b349594eba974aa8aa44bcc7 Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sun, 13 Dec 2015 19:32:17 +0800 Subject: [PATCH] gui/experiments: fix Qt compatibility issue with QHeaderView.setResizeMode --- artiq/gui/experiments.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/artiq/gui/experiments.py b/artiq/gui/experiments.py index 675514727..9412404b1 100644 --- a/artiq/gui/experiments.py +++ b/artiq/gui/experiments.py @@ -132,9 +132,13 @@ class _ArgumentEditor(QtGui.QTreeWidget): QtGui.QTreeWidget.__init__(self) self.setColumnCount(3) self.header().setStretchLastSection(False) - self.header().setResizeMode(0, QtGui.QHeaderView.ResizeToContents) - self.header().setResizeMode(1, QtGui.QHeaderView.Stretch) - self.header().setResizeMode(2, QtGui.QHeaderView.ResizeToContents) + if hasattr(self.header(), "setSectionResizeMode"): + set_resize_mode = self.header().setSectionResizeMode + else: + set_resize_mode = self.header().setResizeMode + set_resize_mode(0, QtGui.QHeaderView.ResizeToContents) + set_resize_mode(1, QtGui.QHeaderView.Stretch) + set_resize_mode(2, QtGui.QHeaderView.ResizeToContents) self.header().setVisible(False) self.setSelectionMode(QtGui.QAbstractItemView.NoSelection) self.setHorizontalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel)