TB: When showing item at index, expand parent, not item

This commit is contained in:
Kovid Goyal 2011-06-27 14:39:54 -06:00
parent ccfff7f456
commit f87375c45e

View File

@ -571,9 +571,10 @@ class TagsView(QTreeView): # {{{
def show_item_at_index(self, idx, box=False,
position=QTreeView.PositionAtCenter):
if idx.isValid() and idx.data(Qt.UserRole).toPyObject() is not self._model.root_item:
self.setExpanded(idx, True) # Needed otherwise Qt segfaults if the
# node is buried in a collapsed, off
# screen hierarchy
self.expand(self._model.parent(idx)) # Needed otherwise Qt sometimes segfaults if the
# node is buried in a collapsed, off
# screen hierarchy
self.setCurrentIndex(idx)
self.scrollTo(idx, position)
if box:
self._model.set_boxed(idx)