From 119c5fa3d0e1d222961f091183983adaead07259 Mon Sep 17 00:00:00 2001 From: KIU Shueng Chuan Date: Sun, 10 Jan 2021 11:49:06 +0800 Subject: [PATCH] convert QTreeWidget.setFirstItemColumnSpanned convert QTreeWidget.setFirstItemColumnSpanned(item, True) to item.setFirstColumnSpanned(True) the former is deprecated since Qt 5.15.2 and removed in Qt 6. --- pyqtgraph/parametertree/parameterTypes.py | 10 +++++----- pyqtgraph/widgets/DataTreeWidget.py | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/pyqtgraph/parametertree/parameterTypes.py b/pyqtgraph/parametertree/parameterTypes.py index 7742357f..40262078 100644 --- a/pyqtgraph/parametertree/parameterTypes.py +++ b/pyqtgraph/parametertree/parameterTypes.py @@ -429,11 +429,11 @@ class GroupParameterItem(ParameterItem): tw = self.treeWidget() if tw is None: return - tw.setFirstItemColumnSpanned(self, True) + self.setFirstColumnSpanned(True) if self.addItem is not None: tw.setItemWidget(self.addItem, 0, self.addWidgetBox) - tw.setFirstItemColumnSpanned(self.addItem, True) - + self.addItem.setFirstColumnSpanned(True) + def addChild(self, child): ## make sure added childs are actually inserted before add btn if self.addItem is not None: ParameterItem.insertChild(self, self.childCount()-1, child) @@ -609,7 +609,7 @@ class ActionParameterItem(ParameterItem): if tree is None: return - tree.setFirstItemColumnSpanned(self, True) + self.setFirstColumnSpanned(True) tree.setItemWidget(self, 0, self.layoutWidget) def titleChanged(self): @@ -646,7 +646,7 @@ class TextParameterItem(WidgetParameterItem): if tw is None: return - tw.setFirstItemColumnSpanned(self.subItem, True) + self.subItem.setFirstColumnSpanned(True) tw.setItemWidget(self.subItem, 0, self.textBox) # for now, these are copied from ParameterItem.treeWidgetChanged diff --git a/pyqtgraph/widgets/DataTreeWidget.py b/pyqtgraph/widgets/DataTreeWidget.py index edcfd427..ad9bf49a 100644 --- a/pyqtgraph/widgets/DataTreeWidget.py +++ b/pyqtgraph/widgets/DataTreeWidget.py @@ -65,7 +65,7 @@ class DataTreeWidget(QtGui.QTreeWidget): subnode = QtGui.QTreeWidgetItem(["", "", ""]) node.addChild(subnode) self.setItemWidget(subnode, 0, widget) - self.setFirstItemColumnSpanned(subnode, True) + subnode.setFirstColumnSpanned(True) # recurse to children for key, data in childs.items():