File indexing completed on 2025-01-26 04:11:38

0001 # SPDX-License-Identifier: CC0-1.0
0002 
0003 
0004 class FilterManagerTreeItem(object):
0005 
0006     def __init__(self, data, parent=None):
0007         self.itemData = data
0008         self.parentItem = parent
0009         self.childItems = []
0010 
0011     def appendChild(self, child):
0012         self.childItems.append(child)
0013 
0014     def appenChildren(self, children):
0015         self.childItems.extend(children)
0016 
0017     def child(self, row):
0018         return self.childItems[row]
0019 
0020     def childCount(self):
0021         return len(self.childItems)
0022 
0023     def columnCount(self):
0024         return len(self.itemData)
0025 
0026     def data(self, column):
0027         try:
0028             return self.itemData[column]
0029         except IndexError:
0030             return None
0031 
0032     def row(self):
0033         if self.parentItem:
0034             return self.parentItem.childItems.index(self)
0035         return 0
0036 
0037     def parent(self):
0038         return self.parentItem