[PyKDE] Cannot connect QSplitter signal
Ruben Bolaño
r.bolano at oan.es
Sat Jun 28 13:50:01 BST 2003
On Saturday 28 June 2003 07:05, 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?
I am not a PyQt expert but I think you got this error because childEvent is a
protected member function, not a signal. If you want to make a QSplitter
widget detect double-click event you should reimplement the
QObject::customEvent(QCustomEvent *) protected member function. When you
construct a QCustomEvent, you have to specify a type that can be
QEvent::MouseButtonDblClick.
Rubén.
More information about the PyQt
mailing list