本文整理汇总了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)
示例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))
示例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)
示例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)
示例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)