I have created a basic treeview with checkboxes and below is the code:
class StdItemModel(QStandardItemModel):
def __init__(self, parent = None):
super(StdItemModel, self).__init__(parent)
class CheckBoxTreeView(QTreeView):
def __init__(self, parent = None):
super(CheckBoxTreeView, self).__init__(parent)
self.mylist = ['STB1','STB2','STB3','STB4','STB5','STB6','STB7','STB8']
self.MainUI()
def MainUI(self):
self.stdmodel = StdItemModel()
for val in self.mylist:
item = QStandardItem(val)
item.setCheckable(True)
self.stdmodel.appendRow([item])
self.setModel(self.stdmodel) # Add Elements
When I run this code, the tree view with checkbox is displayed, but the title is set to 1. How do I change the title? Any help is highly appreciated?