Fix #8271 (Tag editor forgets position)

This commit is contained in:
Kovid Goyal 2011-01-21 11:20:08 -07:00
parent 1e2501e8da
commit ceb28df1b0

View File

@ -79,6 +79,8 @@ class TagEditor(QDialog, Ui_TagEditor):
def apply_tags(self, item=None):
items = self.available_tags.selectedItems() if item is None else [item]
rows = [self.available_tags.row(i) for i in items]
row = max(rows)
for item in items:
tag = unicode(item.text())
self.tags.append(tag)
@ -89,6 +91,12 @@ class TagEditor(QDialog, Ui_TagEditor):
for tag in self.tags:
self.applied_tags.addItem(tag)
if row >= self.available_tags.count():
row = self.available_tags.count() - 1
if row > 2:
item = self.available_tags.item(row)
self.available_tags.scrollToItem(item)
def unapply_tags(self, item=None):