python - Why is the layout, don't update? -
i need, clear chartviewers layout, when do, can't delete last widget. when test length of layout, 0 widget still here after update of layout, in picture :
here code when delete, widgets , graphs
print("proceding delete chart ", chartname, " @ : ", indexgraph) currentgraph = self.charts[indexgraph] currentwidget = self.chartvs[indexgraph] self.chartlayout.removewidget(currentwidget) self.chartvs.remove(currentwidget) currentgraph.cleardata() self.charts.remove(currentgraph) self.chartlayout.update() #currentwidget.resetcachedcontent() listgraphs.remove(chartname) self.refreshlistwithopt(self.charttree, listgraphs, 1, optgraphs) and here code create graphs , add layout:
self.charts.append(chartclass(patientstr, exp)) print("\nnew plot chart ", self.charts[lastindex].name, " length : ", lastindex ) listgraphs.append(self.charts[lastindex].name) print("list graphs : ", listgraphs) self.charts[lastindex].plotjson(mydata.plot(patientstr, exp)) self.chartvs.append(qchartview(self.charts[lastindex])) self.chartvs[lastindex].setrenderhint(qpainter.antialiasing) self.chartlayout.insertwidget(0, self.chartvs[lastindex]) any suggestion?
when widget added main widget default position 0, 0, when add layout position handled it, if remove layout return initial position, visually generating effect of not being delete, solve must delete widget use method deletelater()

Comments
Post a Comment