本文整理汇总了Python中vistrails.gui.pipeline_view.QPipelineView.mousePressEvent方法的典型用法代码示例。如果您正苦于以下问题:Python QPipelineView.mousePressEvent方法的具体用法?Python QPipelineView.mousePressEvent怎么用?Python QPipelineView.mousePressEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vistrails.gui.pipeline_view.QPipelineView
的用法示例。
在下文中一共展示了QPipelineView.mousePressEvent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: mousePressEvent
# 需要导入模块: from vistrails.gui.pipeline_view import QPipelineView [as 别名]
# 或者: from vistrails.gui.pipeline_view.QPipelineView import mousePressEvent [as 别名]
def mousePressEvent(self, event):
""" mousePressEvent(event: QMouseEvent) -> None
Toggle port selection
"""
buttons = self.translateButton(event)
if buttons == QtCore.Qt.LeftButton:
scenePos = self.mapToScene(event.pos())
item = self.scene().itemAt(scenePos)
if isinstance(item, QAbstractGraphicsPortItem):
is_input = item.port.type == 'input'
if self.single_output and not is_input and len(self._selected_output_ports) > 0 and item != self._selected_output_ports[0]:
# Deselect current output port if another port selected in single output mode
self._selected_output_ports[0].setSelected(False)
del self._selected_output_ports[:]
if is_input:
port_set = self._selected_input_ports
else:
port_set = self._selected_output_ports
if item in port_set:
port_set.remove(item)
else:
port_set.append(item)
self._clicked_port = item
else:
self._clicked_port = None
event.accept()
else:
QPipelineView.mousePressEvent(self, event)