eric6/E5Gui/E5TreeWidget.py

changeset 8218
7c09585bd960
parent 8205
4a0f1f896341
child 8228
772103b14c18
equal deleted inserted replaced
8217:385f60c94548 8218:7c09585bd960
30 """ 30 """
31 Constructor 31 Constructor
32 32
33 @param parent reference to the parent widget (QWidget) 33 @param parent reference to the parent widget (QWidget)
34 """ 34 """
35 super(E5TreeWidget, self).__init__(parent) 35 super().__init__(parent)
36 36
37 self.__refreshAllItemsNeeded = True 37 self.__refreshAllItemsNeeded = True
38 self.__allTreeItems = [] 38 self.__allTreeItems = []
39 self.__showMode = E5TreeWidget.ItemsCollapsed 39 self.__showMode = E5TreeWidget.ItemsCollapsed
40 40
133 Public method to add a top level item. 133 Public method to add a top level item.
134 134
135 @param item item to be added as a top level item (QTreeWidgetItem) 135 @param item item to be added as a top level item (QTreeWidgetItem)
136 """ 136 """
137 self.__allTreeItems.append(item) 137 self.__allTreeItems.append(item)
138 super(E5TreeWidget, self).addTopLevelItem(item) 138 super().addTopLevelItem(item)
139 139
140 def addTopLevelItems(self, items): 140 def addTopLevelItems(self, items):
141 """ 141 """
142 Public method to add a list of top level items. 142 Public method to add a list of top level items.
143 143
144 @param items items to be added as top level items 144 @param items items to be added as top level items
145 (list of QTreeWidgetItem) 145 (list of QTreeWidgetItem)
146 """ 146 """
147 self.__allTreeItems.extend(items) 147 self.__allTreeItems.extend(items)
148 super(E5TreeWidget, self).addTopLevelItems(items) 148 super().addTopLevelItems(items)
149 149
150 def insertTopLevelItem(self, index, item): 150 def insertTopLevelItem(self, index, item):
151 """ 151 """
152 Public method to insert a top level item. 152 Public method to insert a top level item.
153 153
154 @param index index for the insertion (integer) 154 @param index index for the insertion (integer)
155 @param item item to be inserted as a top level item (QTreeWidgetItem) 155 @param item item to be inserted as a top level item (QTreeWidgetItem)
156 """ 156 """
157 self.__allTreeItems.append(item) 157 self.__allTreeItems.append(item)
158 super(E5TreeWidget, self).insertTopLevelItem(index, item) 158 super().insertTopLevelItem(index, item)
159 159
160 def insertTopLevelItems(self, index, items): 160 def insertTopLevelItems(self, index, items):
161 """ 161 """
162 Public method to insert a list of top level items. 162 Public method to insert a list of top level items.
163 163
164 @param index index for the insertion (integer) 164 @param index index for the insertion (integer)
165 @param items items to be inserted as top level items 165 @param items items to be inserted as top level items
166 (list of QTreeWidgetItem) 166 (list of QTreeWidgetItem)
167 """ 167 """
168 self.__allTreeItems.extend(items) 168 self.__allTreeItems.extend(items)
169 super(E5TreeWidget, self).insertTopLevelItems(index, items) 169 super().insertTopLevelItems(index, items)
170 170
171 def deleteItem(self, item): 171 def deleteItem(self, item):
172 """ 172 """
173 Public method to delete an item. 173 Public method to delete an item.
174 174
234 def clear(self): 234 def clear(self):
235 """ 235 """
236 Public slot to clear the tree. 236 Public slot to clear the tree.
237 """ 237 """
238 self.__allTreeItems = [] 238 self.__allTreeItems = []
239 super(E5TreeWidget, self).clear() 239 super().clear()
240 240
241 def __scheduleRefresh(self): 241 def __scheduleRefresh(self):
242 """ 242 """
243 Private slot to schedule a refresh of the tree. 243 Private slot to schedule a refresh of the tree.
244 """ 244 """
258 return 258 return
259 elif evt.buttons() == Qt.MouseButton.MidButton: 259 elif evt.buttons() == Qt.MouseButton.MidButton:
260 self.itemMiddleButtonClicked.emit(self.itemAt(evt.pos())) 260 self.itemMiddleButtonClicked.emit(self.itemAt(evt.pos()))
261 return 261 return
262 else: 262 else:
263 super(E5TreeWidget, self).mousePressEvent(evt) 263 super().mousePressEvent(evt)
264 264
265 def __iterateAllItems(self, parent): 265 def __iterateAllItems(self, parent):
266 """ 266 """
267 Private method to iterate over the child items of the parent. 267 Private method to iterate over the child items of the parent.
268 268

eric ide

mercurial