347 parent.methodCount = len(vlist) |
347 parent.methodCount = len(vlist) |
348 else: |
348 else: |
349 row = parent.parent.childs.index(parent) |
349 row = parent.parent.childs.index(parent) |
350 parentIdx = self.createIndex(row, 0, parent) |
350 parentIdx = self.createIndex(row, 0, parent) |
351 |
351 |
352 if itemStartIndex == -2: |
352 if itemStartIndex == -3: |
|
353 # Item doesn't exist any more |
|
354 parentIdx = self.parent(parentIdx) |
|
355 self.beginRemoveRows(parentIdx, row, row) |
|
356 del parent.parent.childs[row] |
|
357 self.endRemoveRows() |
|
358 parent.parent.childCount -= 1 |
|
359 return |
|
360 |
|
361 elif itemStartIndex == -2: |
353 parent.currentCount = parent.absolutCount |
362 parent.currentCount = parent.absolutCount |
354 # Remove items which are left over at the end of child list |
363 # Remove items which are left over at the end of child list |
355 self.__cleanupParentList(parent, parentIdx) |
364 self.__cleanupParentList(parent, parentIdx) |
356 return |
365 return |
357 |
366 |
358 elif itemStartIndex == -1: |
367 elif itemStartIndex == -1: |
359 parent.methodCount = len(vlist) |
368 parent.methodCount = len(vlist) |
360 parent.currentCount = parent.absolutCount |
369 idx = parent.childCount = parent.currentCount + 1 |
361 idx = parent.childCount |
370 parent.currentCount += 1 + len(vlist) |
362 else: |
371 else: |
|
372 idx = parent.currentCount + 1 |
363 parent.currentCount += len(vlist) |
373 parent.currentCount += len(vlist) |
364 idx = itemStartIndex |
|
365 |
374 |
366 # Sort items for Python versions where dict doesn't retain order |
375 # Sort items for Python versions where dict doesn't retain order |
367 vlist.sort(key=lambda x: x[0]) |
376 vlist.sort(key=lambda x: x[0]) |
368 # Now update the table |
377 # Now update the table |
369 endIndex = idx + len(vlist) |
378 endIndex = idx + len(vlist) |
479 |
488 |
480 self.closedItems = [] |
489 self.closedItems = [] |
481 |
490 |
482 # Little quirk: Refresh all visible items to clear the changed marker |
491 # Little quirk: Refresh all visible items to clear the changed marker |
483 if parentIdx == QModelIndex(): |
492 if parentIdx == QModelIndex(): |
|
493 self.rootNode.currentCount = -1 |
484 idxStart = self.index(0, 0, QModelIndex()) |
494 idxStart = self.index(0, 0, QModelIndex()) |
485 idxEnd = self.index(0, 2, QModelIndex()) |
495 idxEnd = self.index(0, 2, QModelIndex()) |
486 self.dataChanged.emit(idxStart, idxEnd) |
496 self.dataChanged.emit(idxStart, idxEnd) |
487 |
497 |
488 def columnCount(self, parent=QModelIndex()): |
498 def columnCount(self, parent=QModelIndex()): |