[PyKDE] qtdesigner and pysignals

Andreas Pakulat apaku at gmx.de
Tue Aug 29 14:18:41 BST 2006


On 29.08.06 14:48:28, Felix Steffenhagen wrote:
> I'm using qtdesigner and pyqt do easy develop a
> nice looking GUI, but now I have the problem,
> that I want to connect PYSIGNALS from widgets
> to SLOTS/functions of other widgets.
> 
> Using pyuic to translate the designers' .ui files,
> it only generates connect-statements for C++-Signals.
> 
> Is there a possibility to define PYSIGNALS in the qtdesigner
> which will be translated correctly by pyuic?

Are you using PyQt3 or PyQt4? For PyQt3 just use the connections and
slots dialog and create new functions on the form which you then connect
to the signals you want. This works perfectly here, i.e. pyuic generates
code like this:

        self.connect(self.groupBox1,SIGNAL("toggled(bool)"),self.newSlot)

You only have to subclass the generated class and implement the slot.

For PyQt4: You can have auto-connect-slots as explained in the Qt4
documentation about designer. You may also need to use the
@pyqtSignature decorator to avoid ambiguities and thus a slot beeing
called twice for a single signal. See the PyQt4 documentation for more
about this and the example programs of course.

Andreas

-- 
You dialed 5483.




More information about the PyQt mailing list