[PyKDE] Cannot connect QSplitter signal
    Phil Thompson 
    phil at riverbankcomputing.co.uk
       
    Sat Jun 28 16:10:01 BST 2003
    
    
  
On Saturday 28 June 2003 6:05 am, Toru Furukawa wrote:
> I want to make a QSplitter widget detect double-click event, but I
> cannot figure out how.
>
> Platform: WindowsXP / Python2.2.2 / Qt2.3 / PyQt-3.6
>
> I tried this code;
> # sp.py
> from qt import *
> app = QApplication([])
> s = QSplitter()
> app.setMainWidget(s)
> s.show()
> app.connect(s, SIGNAL("childEvent(QChildEvent *e)"), PYSIGNAL("foo"))
> app.exec_loop()
>
> and I got the following error.
>
> Traceback (most recent call last):
>   File "sp.py", line 6, in ?
>     app.connect(s, SIGNAL("childEvent(QChildEvent *e)"), PYSIGNAL("foo"))
> RuntimeError: Signal has wrong argument types for slot
>
> Then, I tried "labmda e: 0" instead of PYSIGNAL("foo"), and I got the
> same error.  What is wrong with my code?
childEvent() isn't a signal. Even if it was you shouldn't include the argument 
name (ie. "e") in the signature string. Also, a QChildEvent deals with the 
addition and removal of children in a QObject hierarchy.
The solution is to sub-class QSplitter and re-implement 
mouseDoubleClickEvent().
Phil
    
    
More information about the PyQt
mailing list