[PyKDE] Custom slots with Qt Designer 4.1

Andreas Pakulat apaku at gmx.de
Wed Jan 25 14:39:46 GMT 2006


On 25.01.06 15:27:51, Fabio Spelta wrote:
> I've seen how to associate signals to slots in the qt3 edition of Qt
> Designer, and then how to write python functions that implements these
> methods.
> It seems (http://www.qtcentre.org/forum/showthread.php?t=34) that
> designer 4.1 does not allow to associate custom slots to signals, so

designer 4.1 is only able to connect signals from existing widgets with
slots from existing widgets. 

> I'm wondering if there is a "confortable" way to manage events others
> than the default ones in application which GUI is created with the
> designer interface.

The most comfortable way to respond to signals of widgets that are
contained in the form you create is to use autoconnect, this means your
slots have to follow a specific naming convention which is

on_widget_signal(self, param1, param2, ...)

Where widget is the name of the widget that emits signal and the
param1-n are the parameters. Note that this feature of pyuic4 is pretty
new and thus needs some more work. For example QSpinBox emits 2
valueChanged signals and a slot called

on_spinbox_valueChanged(self, value)

gets called twice.

Andreas

-- 
You never know how many friends you have until you rent a house on the beach.




More information about the PyQt mailing list