kopia lustrzana https://github.com/corrscope/corrscope
Fix ChannelModel.insert/removeRows
rodzic
e5bb4f23e3
commit
53263b3a92
|
@ -528,13 +528,14 @@ class ChannelModel(qc.QAbstractTableModel):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self.beginInsertRows(parent, row, row + count - 1)
|
self.beginInsertRows(parent, row, row + count - 1)
|
||||||
self.channels.insert(row, [ChannelConfig('') for _ in range(count)])
|
self.channels[row:row] = [ChannelConfig('') for _ in range(count)]
|
||||||
self.endInsertRows()
|
self.endInsertRows()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def removeRows(self, row: int, count: int, parent: QModelIndex = ...) -> bool:
|
def removeRows(self, row: int, count: int, parent: QModelIndex = ...) -> bool:
|
||||||
nchan = len(self.channels)
|
nchan = len(self.channels)
|
||||||
if not (count >= 1 and 0 <= row < nchan and row + count <= nchan):
|
# row <= nchan for consistency.
|
||||||
|
if not (count >= 1 and 0 <= row <= nchan and row + count <= nchan):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
self.beginRemoveRows(parent, row, row + count - 1)
|
self.beginRemoveRows(parent, row, row + count - 1)
|
||||||
|
|
Ładowanie…
Reference in New Issue