当前位置: 首页>>代码示例>>Python>>正文


Python QGraphicsTextItem.focusOutEvent方法代码示例

本文整理汇总了Python中PyQt5.QtWidgets.QGraphicsTextItem.focusOutEvent方法的典型用法代码示例。如果您正苦于以下问题:Python QGraphicsTextItem.focusOutEvent方法的具体用法?Python QGraphicsTextItem.focusOutEvent怎么用?Python QGraphicsTextItem.focusOutEvent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt5.QtWidgets.QGraphicsTextItem的用法示例。


在下文中一共展示了QGraphicsTextItem.focusOutEvent方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: focusOutEvent

# 需要导入模块: from PyQt5.QtWidgets import QGraphicsTextItem [as 别名]
# 或者: from PyQt5.QtWidgets.QGraphicsTextItem import focusOutEvent [as 别名]
    def focusOutEvent(self, event):
        '''Handle focus out event.

        Argument(s):
        event (QFocusEvent ): Focus event
        '''
        QGraphicsTextItem.focusOutEvent(self, event)

        # Create a fake node to test if label is valid with pydot
        fakeNode = ("fake[" + NodeDotAttrs.label.value +
                    "=" + self.toPlainText() + "]")
        pydotGraph = graph_from_dot_data("graph{" + fakeNode + "}")

        # Label is valid: we can do the update
        if pydotGraph:
            dicDotAttrs = {
                NodeDotAttrs.label.value:
                NodeDotLabelUtils.formatLabel(self.toPlainText())
            }

            # Update text in other views
            node = self.parentItem()
            node.graphicsGraphView.controller.onEditNode(node.id, dicDotAttrs)

            # Disable edit text
            self.setTextInteractionFlags(Qt.NoTextInteraction)

        # Label is invalid: force user to write a correct label
        else:
            QMessageBox.warning(None, "Syntax error",
                                "The label is invalid.")
            self.setFocus()
开发者ID:pydoted,项目名称:dotEd,代码行数:34,代码来源:GraphicsTextNode.py

示例2: focusOutEvent

# 需要导入模块: from PyQt5.QtWidgets import QGraphicsTextItem [as 别名]
# 或者: from PyQt5.QtWidgets.QGraphicsTextItem import focusOutEvent [as 别名]
 def focusOutEvent(self, event):
     self.inputMethodEvent(event)
     QGraphicsTextItem.focusOutEvent(self, event)
开发者ID:hadim,项目名称:cadnano2.5,代码行数:5,代码来源:insertionitem.py

示例3: focusOutEvent

# 需要导入模块: from PyQt5.QtWidgets import QGraphicsTextItem [as 别名]
# 或者: from PyQt5.QtWidgets.QGraphicsTextItem import focusOutEvent [as 别名]
 def focusOutEvent(self, event):
     self.setTextInteractionFlags(Qt.NoTextInteraction)
     self.textChanged.emit(self.toPlainText())
     self.textEditFinished.emit()
     QGraphicsTextItem.focusOutEvent(self, event)
开发者ID:Diegojnb,项目名称:JdeRobot,代码行数:7,代码来源:idtextboxgraphicsitem.py


注:本文中的PyQt5.QtWidgets.QGraphicsTextItem.focusOutEvent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。