69 return None |
69 return None |
70 |
70 |
71 sindex = self.mapToSource(index) |
71 sindex = self.mapToSource(index) |
72 return self.sourceModel().item(sindex) |
72 return self.sourceModel().item(sindex) |
73 |
73 |
74 def hasChildren(self, parent=QModelIndex()): |
74 def hasChildren(self, parent=None): |
75 """ |
75 """ |
76 Public method to check for the presence of child items. |
76 Public method to check for the presence of child items. |
77 |
77 |
78 We always return True for normal items in order to do lazy |
78 We always return True for normal items in order to do lazy |
79 population of the tree. |
79 population of the tree. |
80 |
80 |
81 @param parent index of parent item (QModelIndex) |
81 @param parent index of parent item (QModelIndex) |
82 @return flag indicating the presence of child items (boolean) |
82 @return flag indicating the presence of child items (boolean) |
83 """ |
83 """ |
|
84 if parent is None: |
|
85 parent = QModelIndex() |
84 sindex = self.mapToSource(parent) |
86 sindex = self.mapToSource(parent) |
85 return self.sourceModel().hasChildren(sindex) |
87 return self.sourceModel().hasChildren(sindex) |
86 |
88 |
87 def filterAcceptsRow(self, source_row, source_parent): |
89 def filterAcceptsRow(self, source_row, source_parent): |
88 """ |
90 """ |