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
|
|
@ -1447,7 +1447,10 @@
|
||||||
</modify-argument>
|
</modify-argument>
|
||||||
</modify-function>
|
</modify-function>
|
||||||
<modify-function signature="thread() const" remove="all"/>
|
<modify-function signature="thread() const" remove="all"/>
|
||||||
<modify-function signature="connect(const QObject*, const char*, const char *, Qt::ConnectionType) const" remove="all"/>
|
<modify-function signature="connect(const QObject*, const char*, const char *, Qt::ConnectionType) const">
|
||||||
|
// %FUNCTION_NAME() - disable generation of function call.
|
||||||
|
%PYARG_0 = %CONVERTTOPYTHON[bool](qobjectConnect(%1, %2, %CPPSELF, %4));
|
||||||
|
</modify-function>
|
||||||
<modify-function signature="connect(const QObject*, const char*, const QObject*, const char *, Qt::ConnectionType)">
|
<modify-function signature="connect(const QObject*, const char*, const QObject*, const char *, Qt::ConnectionType)">
|
||||||
<inject-code class="target" position="beginning" file="">
|
<inject-code class="target" position="beginning" file="">
|
||||||
// %FUNCTION_NAME() - disable generation of function call.
|
// %FUNCTION_NAME() - disable generation of function call.
|
||||||
|
|
|
||||||
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