[PyKDE] Connection SLOT: textChanged

Jonathan Gardner jgardn at alumni.washington.edu
Wed Mar 6 17:05:51 GMT 2002

On Wed, Mar 06, 2002 at 04:50:47PM +0000, Benoit DELAGARDE wrote:
> I want to connect to the QLineEdit::textChanged in python-Qt, witch
> take a QString as parameter. 

No, it takes  "const QString&" as an argument. Check the documentation
for Qt. You're no longer 100% in Python. You're walking the wall that
divides C++ and Python now. It will help if you learn a little C++.

> I tried: 
>   foo.connect(bar, SLOT('textChanged()'), foo.somthingchanged)
>   foo.connect(bar, SLOT('textChanged(QString)'), foo.somthingchanged)
>   foo.connect(bar, SLOT('textChanged(string)'), foo.somthingchanged)
> the fisrt do nothing, the two others fail in foo.connect
> How can i achieve this?

You can double-check, triple-check, quadruple-check, and check again
that you have the proper C++ method. (With connection problems, you
should study the Qt documentation very closely.)

And remember, signals connect to slots. Slots are just methods and
functions for python, but they are special functions for C++.

    SIGNAL('textChanged(const QString&)'),

> Im sorry to ask an already asked question but im stuck with this.

This is a common obstacle for newbies. It results from not reading the
documentation with an eagle's eye. Qt is great because it has great
documentation. It is your new bible. You'll also want to memorize the
documentation that comes with PyQt. It is very terse, but complete.

And welcome to PyQt. I hope you end up enjoying it as much as I do.


More information about the PyQt mailing list