Don't select the child item if not selected

This commit is contained in:
Andreas Preikschat 2011-01-20 17:43:29 +01:00
parent ff2ac445f0
commit 7e57fa2f95
2 changed files with 7 additions and 4 deletions

View File

@ -844,13 +844,13 @@ class ServiceManager(QtGui.QWidget):
treewidgetitem1.setText(0, text[:40]) treewidgetitem1.setText(0, text[:40])
treewidgetitem1.setData(0, QtCore.Qt.UserRole, treewidgetitem1.setData(0, QtCore.Qt.UserRole,
QtCore.QVariant(count)) QtCore.QVariant(count))
if serviceItem == itemcount and serviceItemCount == count: if serviceItem == itemcount:
# Preserve expanding status as setCurrentItem sets it to # Preserve expanding status as setCurrentItem sets it to
# True. # True.
temp = item[u'expanded'] temp = item[u'expanded']
if item[u'expanded']: if item[u'expanded'] and serviceItemCount == count:
self.serviceManagerList.setCurrentItem(treewidgetitem1) self.serviceManagerList.setCurrentItem(treewidgetitem1)
else: elif serviceItemCount == -1:
self.serviceManagerList.setCurrentItem(treewidgetitem) self.serviceManagerList.setCurrentItem(treewidgetitem)
item[u'expanded'] = temp item[u'expanded'] = temp
treewidgetitem.setExpanded(item[u'expanded']) treewidgetitem.setExpanded(item[u'expanded'])
@ -1060,7 +1060,7 @@ class ServiceManager(QtGui.QWidget):
""" """
items = self.serviceManagerList.selectedItems() items = self.serviceManagerList.selectedItems()
pos = 0 pos = 0
count = 0 count = -1
for item in items: for item in items:
parentitem = item.parent() parentitem = item.parent()
if parentitem is None: if parentitem is None:

View File

@ -525,6 +525,9 @@ class SlideController(QtGui.QWidget):
Called by ServiceManager Called by ServiceManager
""" """
log.debug(u'addServiceManagerItem live = %s' % self.isLive) log.debug(u'addServiceManagerItem live = %s' % self.isLive)
# If no valid slide number is specified we take the first one.
if slideno == -1:
slideno = 0
# If service item is the same as the current on only change slide # If service item is the same as the current on only change slide
if item.__eq__(self.serviceItem): if item.__eq__(self.serviceItem):
if slideno + 1 < self.PreviewListWidget.rowCount(): if slideno + 1 < self.PreviewListWidget.rowCount():