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


Python QObject.disconnect方法代码示例

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


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

示例1: testButton

# 需要导入模块: from PySide2.QtCore import QObject [as 别名]
# 或者: from PySide2.QtCore.QObject import disconnect [as 别名]
 def testButton(self):
     #Connecting a lambda to a QPushButton.clicked()
     obj = QPushButton('label')
     ctr = Control()
     func = lambda: setattr(ctr, 'arg', True)
     QObject.connect(obj, SIGNAL('clicked()'), func)
     obj.click()
     self.assert_(ctr.arg)
     QObject.disconnect(obj, SIGNAL('clicked()'), func)
开发者ID:BadSingleton,项目名称:pyside2,代码行数:11,代码来源:lambda_gui_test.py

示例2: testObjectRefcount

# 需要导入模块: from PySide2.QtCore import QObject [as 别名]
# 或者: from PySide2.QtCore.QObject import disconnect [as 别名]
 def testObjectRefcount(self):
     """Emission of QObject.destroyed() to a python slot"""
     def callback():
         pass
     obj = QObject()
     refcount = getrefcount(obj)
     QObject.connect(obj, SIGNAL('destroyed()'), callback)
     self.assertEqual(refcount, getrefcount(obj))
     QObject.disconnect(obj, SIGNAL('destroyed()'), callback)
     self.assertEqual(refcount, getrefcount(obj))
开发者ID:BadSingleton,项目名称:pyside2,代码行数:12,代码来源:signal_manager_refcount_test.py

示例3: testSpinButton

# 需要导入模块: from PySide2.QtCore import QObject [as 别名]
# 或者: from PySide2.QtCore.QObject import disconnect [as 别名]
 def testSpinButton(self):
     #Connecting a lambda to a QPushButton.clicked()
     obj = QSpinBox()
     ctr = Control()
     arg = 444
     func = lambda x: setattr(ctr, 'arg', 444)
     QObject.connect(obj, SIGNAL('valueChanged(int)'), func)
     obj.setValue(444)
     self.assertEqual(ctr.arg, arg)
     QObject.disconnect(obj, SIGNAL('valueChanged(int)'), func)
开发者ID:BadSingleton,项目名称:pyside2,代码行数:12,代码来源:lambda_gui_test.py

示例4: testDisconnect

# 需要导入模块: from PySide2.QtCore import QObject [as 别名]
# 或者: from PySide2.QtCore.QObject import disconnect [as 别名]
    def testDisconnect(self):
        obj1 = Dummy()

        QObject.connect(obj1, SIGNAL("foo(int)"), self.callback)
        QObject.disconnect(obj1, SIGNAL("foo(int)"), self.callback)

        self.args = (42,)
        obj1.emit(SIGNAL("foo(int)"), *self.args)

        self.assert_(not self.called)
开发者ID:linzhun,项目名称:pyside2,代码行数:12,代码来源:pysignal_test.py

示例5: testRefCount

# 需要导入模块: from PySide2.QtCore import QObject [as 别名]
# 或者: from PySide2.QtCore.QObject import disconnect [as 别名]
    def testRefCount(self):
        def cb(*args):
            pass

        self.assertEqual(getrefcount(cb), 2)

        QObject.connect(self.emitter, SIGNAL('destroyed()'), cb)
        self.assertEqual(getrefcount(cb), 3)

        QObject.disconnect(self.emitter, SIGNAL('destroyed()'), cb)
        self.assertEqual(getrefcount(cb), 2)
开发者ID:BadSingleton,项目名称:pyside2,代码行数:13,代码来源:slot_reference_count_test.py


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