本文整理匯總了Python中AnyQt.QtWidgets.QGraphicsWidget.mouseReleaseEvent方法的典型用法代碼示例。如果您正苦於以下問題:Python QGraphicsWidget.mouseReleaseEvent方法的具體用法?Python QGraphicsWidget.mouseReleaseEvent怎麽用?Python QGraphicsWidget.mouseReleaseEvent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類AnyQt.QtWidgets.QGraphicsWidget
的用法示例。
在下文中一共展示了QGraphicsWidget.mouseReleaseEvent方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: mouseReleaseEvent
# 需要導入模塊: from AnyQt.QtWidgets import QGraphicsWidget [as 別名]
# 或者: from AnyQt.QtWidgets.QGraphicsWidget import mouseReleaseEvent [as 別名]
def mouseReleaseEvent(self, event):
if event.button() == Qt.LeftButton and self.__tmpLine:
endItem = find_item_at(self.scene(), event.scenePos(),
type=ChannelAnchor)
if endItem is not None:
startItem = self.__dragStartItem
startChannel = startItem.channel()
endChannel = endItem.channel()
possible = False
# Make sure the drag was from input to output (or reversed) and
# not between input -> input or output -> output
if type(startChannel) != type(endChannel):
if isinstance(startChannel, InputSignal):
startChannel, endChannel = endChannel, startChannel
possible = compatible_channels(startChannel, endChannel)
if possible:
self.addLink(startChannel, endChannel)
self.scene().removeItem(self.__tmpLine)
self.__tmpLine = None
self.__dragStartItem = None
QGraphicsWidget.mouseReleaseEvent(self, event)