示例#1
0
    def toggleTree(self, index, expand):
        ''' Expand or collapse an entire sub-tree of an index '''
        # Separate function to deal with filtering capability
        if not index.isValid():
            return

        model = self.model()
        mods = QApplication.keyboardModifiers()
        thing = model.itemFromIndex(index)
        thing.expanded[id(self)] = expand

        if mods & (self.expandModifier | self.depthModifier):
            queue = [index]
            self.blockSignals(True)
            try:
                while queue:
                    idx = queue.pop()
                    thing = model.itemFromIndex(idx)
                    thing.expanded[id(self)] = expand
                    self.setExpanded(idx, expand)
                    if mods & self.depthModifier:
                        if isinstance(thing, Group):
                            continue
                    for i in xrange(model.rowCount(idx)):
                        child = model.index(i, 0, idx)
                        if child and child.isValid():
                            queue.append(child)
            finally:
                self.blockSignals(False)

        if expand:
            self.resizeColumns()
示例#2
0
 def unifySelection(self):
     ''' Clear the selection if no modifiers are being held '''
     mods = QApplication.keyboardModifiers()
     if not mods & (Qt.ControlModifier | Qt.ShiftModifier):
         selModel = self.selectionModel()
         selModel.blockSignals(True)
         try:
             selModel.clearSelection()
         finally:
             selModel.blockSignals(False)
         self.viewport().update()
示例#3
0
	def unifyComboSelection(self):
		''' Clear the selection of the slider tree when
		an item on the combo tree is selected '''
		mods = QApplication.keyboardModifiers()
		if not mods & (Qt.ControlModifier | Qt.ShiftModifier):
			sliderSelModel = self.uiSliderTREE.selectionModel()
			if not sliderSelModel:
				return
			with signalsBlocked(sliderSelModel):
				sliderSelModel.clearSelection()
			self.uiSliderTREE.viewport().update()