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:
Daniel Schadt 2016-05-08 23:28:01 +02:00
parent 99182e3e79
commit 1fa50021c1

View File

@ -897,8 +897,8 @@ class DownloadManager(QAbstractListModel):
download.redirected.connect(
functools.partial(self.on_redirect, download))
download.basename = suggested_filename
idx = len(self.downloads) + 1
download.index = idx
idx = len(self.downloads)
download.index = idx + 1 # "Human readable" index
self.beginInsertRows(QModelIndex(), idx, idx)
self.downloads.append(download)
self.endInsertRows()