I am trying to design a QTabwidget having two tabs in it. The tab should change based on selection from a QComboBox. I have to populate a QTreewidget instance in the two tabs based on the selection from the combo box i.e same tree should be displayed whenever i switch tabs. I tried creating layouts inside tab and added the same Tree to both the layouts. It works for the first time i.e when i switch tabs I can see the same tree in both the tabs.
Next time i try to do that it gives me warning " Attempting to add Layout to widget which already has a layout". I tried creating logic to check if my tree widget already has layout and if so , delete the old layout and initialize it with new layout but no luck.Qt Code:
if(self.ui.comboReportsNew.currentText()=="Synthesis"): self.ui.tab_2.setLayout(self.leftLayout) self.leftLayout.addWidget(self.ReqTree) //self.ReqTree is the QTreeWidget elif(self.ui.comboReportsNew.currentText()=="Code Coverage"): self.ui.tab.setLayout(self.rightLayout) self.rightLayout.addWidget(self.ReqTree)To copy to clipboard, switch view to plain text mode
Any help will be very appreciated.
Bookmarks