本文整理汇总了Python中PySide.QtGui.QSpinBox.emit方法的典型用法代码示例。如果您正苦于以下问题:Python QSpinBox.emit方法的具体用法?Python QSpinBox.emit怎么用?Python QSpinBox.emit使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtGui.QSpinBox
的用法示例。
在下文中一共展示了QSpinBox.emit方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: SpinBoxPySlot
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import emit [as 别名]
class SpinBoxPySlot(UsesQApplication, BasicPySlotCase):
"""Tests the connection of python slots to QSpinBox signals"""
def setUp(self):
super(SpinBoxPySlot, self).setUp()
self.spin = QSpinBox()
def tearDown(self):
del self.spin
super(SpinBoxPySlot, self).tearDown()
def testSpinBoxValueChanged(self):
"""Connection of a python slot to QSpinBox.valueChanged(int)"""
QObject.connect(self.spin, SIGNAL('valueChanged(int)'), self.cb)
self.args = [3]
self.spin.emit(SIGNAL('valueChanged(int)'), *self.args)
self.assert_(self.called)
def testSpinBoxValueChangedImplicit(self):
"""Indirect qt signal emission using QSpinBox.setValue(int)"""
QObject.connect(self.spin, SIGNAL('valueChanged(int)'), self.cb)
self.args = [42]
self.spin.setValue(self.args[0])
self.assert_(self.called)
def atestSpinBoxValueChangedFewArgs(self):
"""Emission of signals with fewer arguments than needed"""
# XXX: PyQt4 crashes on the assertRaises
QObject.connect(self.spin, SIGNAL('valueChanged(int)'), self.cb)
self.args = (554,)
self.assertRaises(TypeError, self.spin.emit, SIGNAL('valueChanged(int)'))
示例2: testSetValue
# 需要导入模块: from PySide.QtGui import QSpinBox [as 别名]
# 或者: from PySide.QtGui.QSpinBox import emit [as 别名]
def testSetValue(self):
"""Direct signal emission: QSpinBox using valueChanged(int)/setValue(int)"""
spinSend = QSpinBox()
spinRec = QSpinBox()
spinRec.setValue(5)
spinSend.setValue(42)
QObject.connect(spinSend, SIGNAL('valueChanged(int)'), spinRec, SLOT('setValue(int)'))
self.assertEqual(spinRec.value(), 5)
self.assertEqual(spinSend.value(), 42)
spinSend.emit(SIGNAL('valueChanged(int)'), 3)
self.assertEqual(spinRec.value(), 3)
#Direct emission shouldn't change the value of the emitter
self.assertEqual(spinSend.value(), 42)
spinSend.emit(SIGNAL('valueChanged(int)'), 66)
self.assertEqual(spinRec.value(), 66)
self.assertEqual(spinSend.value(), 42)