mirror of https://github.com/m-labs/artiq.git
gui/models/DictSyncTreeSepModel: fix item row update
This commit is contained in:
parent
7bebc52959
commit
537fa2287b
|
@ -276,6 +276,8 @@ class DictSyncTreeSepModel(QtCore.QAbstractItemModel):
|
||||||
|
|
||||||
self.beginInsertRows(self._index_item(parent), row, row)
|
self.beginInsertRows(self._index_item(parent), row, row)
|
||||||
parent.children_by_row.insert(row, item)
|
parent.children_by_row.insert(row, item)
|
||||||
|
for next_item in parent.children_by_row[row+1:]:
|
||||||
|
next_item.row += 1
|
||||||
name_dict[name] = item
|
name_dict[name] = item
|
||||||
self.endInsertRows()
|
self.endInsertRows()
|
||||||
|
|
||||||
|
@ -308,6 +310,8 @@ class DictSyncTreeSepModel(QtCore.QAbstractItemModel):
|
||||||
self.beginRemoveRows(self._index_item(parent), row, row)
|
self.beginRemoveRows(self._index_item(parent), row, row)
|
||||||
del parent.children_leaves_by_name[name]
|
del parent.children_leaves_by_name[name]
|
||||||
del parent.children_by_row[row]
|
del parent.children_by_row[row]
|
||||||
|
for next_item in parent.children_by_row[row:]:
|
||||||
|
next_item.row -= 1
|
||||||
self.endRemoveRows()
|
self.endRemoveRows()
|
||||||
else:
|
else:
|
||||||
# node
|
# node
|
||||||
|
@ -319,6 +323,8 @@ class DictSyncTreeSepModel(QtCore.QAbstractItemModel):
|
||||||
self.beginRemoveRows(self._index_item(parent), row, row)
|
self.beginRemoveRows(self._index_item(parent), row, row)
|
||||||
del parent.children_nodes_by_name[name]
|
del parent.children_nodes_by_name[name]
|
||||||
del parent.children_by_row[row]
|
del parent.children_by_row[row]
|
||||||
|
for next_item in parent.children_by_row[row:]:
|
||||||
|
next_item.row -= 1
|
||||||
self.endRemoveRows()
|
self.endRemoveRows()
|
||||||
|
|
||||||
def __delitem__(self, k):
|
def __delitem__(self, k):
|
||||||
|
|
Loading…
Reference in New Issue