Adding support for connect(obj, signal, slot)
window.connect(button, SIGNAL('clicked()'), SLOT('close()') should
connect button.clicked to window.close
This commit is contained in:
parent
d54d860e13
commit
fad2f7e53d
2 changed files with 41 additions and 1 deletions
37
tests/signals/self_connect_test.py
Normal file
37
tests/signals/self_connect_test.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
'''Using self.connect(signal, method)'''
|
||||
|
||||
import unittest
|
||||
|
||||
from PySide.QtCore import QObject, SIGNAL, SLOT
|
||||
from PySide.QtGui import QPushButton, QWidget
|
||||
|
||||
from helper import UsesQApplication
|
||||
|
||||
|
||||
class SelfConnect(UsesQApplication):
|
||||
|
||||
def testButtonClickClose(self):
|
||||
button = QPushButton()
|
||||
button.connect(button, SIGNAL('clicked()'), SLOT('close()'))
|
||||
|
||||
button.show()
|
||||
self.assert_(button.isVisible())
|
||||
button.click()
|
||||
self.assert_(not button.isVisible())
|
||||
|
||||
def testWindowButtonClickClose(self):
|
||||
button = QPushButton()
|
||||
window = QWidget()
|
||||
window.connect(button, SIGNAL('clicked()'), SLOT('close()'))
|
||||
|
||||
window.show()
|
||||
self.assert_(window.isVisible())
|
||||
button.click()
|
||||
self.assert_(not window.isVisible())
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
Loading…
Add table
Add a link
Reference in a new issue