downloads: use right index for beginInsertRows
len(self.downloads) is already the index of the item in the download list, this should be used for beginInsertRows(). The +1 is only for the human readable part.
This commit is contained in:
parent
99182e3e79
commit
1fa50021c1
@ -897,8 +897,8 @@ class DownloadManager(QAbstractListModel):
|
|||||||
download.redirected.connect(
|
download.redirected.connect(
|
||||||
functools.partial(self.on_redirect, download))
|
functools.partial(self.on_redirect, download))
|
||||||
download.basename = suggested_filename
|
download.basename = suggested_filename
|
||||||
idx = len(self.downloads) + 1
|
idx = len(self.downloads)
|
||||||
download.index = idx
|
download.index = idx + 1 # "Human readable" index
|
||||||
self.beginInsertRows(QModelIndex(), idx, idx)
|
self.beginInsertRows(QModelIndex(), idx, idx)
|
||||||
self.downloads.append(download)
|
self.downloads.append(download)
|
||||||
self.endInsertRows()
|
self.endInsertRows()
|
||||||
|
Loading…
Reference in New Issue
Block a user