如何在TreewidgetItem内添加QT的控件

如何使用python QT 在TreewidgetItem内添加QT的控件,如进度条之类的

以button为例,

 def add_widget(self, button, widget):
        """creates a QWidgetItem containing the widget,
        as child of the button-QWidgetItem
        """
        section = QTreeWidgetItem(button)
        section.setDisabled(True)
        self.tree.setItemWidget(section, 0, widget)
        return section

从原函数上看,继承于widget的组件应该都可以。

void setItemWidget(QTreeWidgetItem *item, int column, QWidget *widget);

如何在qtreewidget中是可以使用有一个setcellwidget这个方法可以实现,但是如何数据量小还行,数据量大起来就会非常卡

img