RuntimeError:内部 C++ 对象(QCustomPlot.QCPPlottableLegendItem)已删除

问题描述 投票:0回答:0
def selectionChanged(self):
    for i in range(self.left_customPlot.graphCount()):
        graph = self.left_customPlot.graph(i)
        item = self.left_customPlot.legend.itemWithPlottable(graph)
        if item.selected():
            item.setSelected(True)
            graph.setSelection(QCPDataSelection(graph.data().dataRange()))
        self.left_customPlot.update()

此代码从c++转换成python代码,c++代码正常运行,python代码在item.setSelected(True) 报错RuntimeError: Internal C++ object (QCustomPlot.QCPPlottableLegendItem) already deleted.

python pyside qcustomplot
© www.soinside.com 2019 - 2024. All rights reserved.