[Tutor] PyQT's signals and slots *correction
Bruce Sass
bsass@freenet.edmonton.ab.ca
Mon, 2 Jul 2001 02:08:34 -0600 (MDT)
On Sun, 1 Jul 2001, Brendon wrote:
> On Sunday 01 July 2001 12:43, you wrote:
> > back again with more questions :)
> >
> > i've decided to try my luck with PyQT for UI design. i'm trying to
> > understand PyQT's signals and slots mechanism, but due to the lack of good
> > examples i've haven't got very far.
> >
> self.buttonConnect.connect(self.buttonConnect, SIGNAL("clicked()"), ????,
> SLOT("conJ()")
??? = the object with the SLOT,
which itself is just a method (as you surmised)
However, I think what you want is...
self.connect(self.buttonConnect, PYSIGNAL("clicked()"), self.conJ)
i.e., the widget connects the buttons "clicked" signal to the
widgets's conJ method. It is a PYSIGNAL because you are connecting
between your own objects, not to Qt.
If your button was (say) a "quit" button (needed to signal the app),
the connect() would have the fourth argument, and look like...
self.connect(self.buttonConnect,SIGNAL('clicked()'),qApp,SLOT('quit()'))
...or so I gathered from translating the Qt tutorials into PyQt
(awhile ago, and I haven't played with it much since, so don't be
too surprised if I steered you wrong :)
- Bruce