[PyKDE] QTreeWidget & Signals

Andreas Pakulat apaku at gmx.de
Mon May 8 22:33:03 BST 2006


On 08.05.06 21:49:05, Sven Flossmann wrote:
> I'm trying to use signals from QTreeWidget, e.g. the
> itemSelectionChanged(), but I have not found a way that works until now.
> 
> Is there anybody out who has got this to work?

Me, see attached very small example.

> I've tried two different ways:
> a) Use the default handler of the containing widget
> def on_treeTasks_itemSelectionChanged(self)

Didn't want to create a ui-file just for this. Note that if you're not
using a .ui-file, you need to call QMetaObject::connectSlotsByName on
the containing widget.

> btw: Is there a possibility on checking for the existance of a signal?
> QObject.connect() method does not care wheather the signal specified
> exists or not.

Right, but if you use a debug-Qt-Build QObject::connect prints a message
when the signal or slot is not correct.

You can also try to use QMetaObject::indexOfSignal, see the Qt docs for
more details. The MetaObject of a given instance is available by calling
QObjet::metaObject. So all you need to do is transform the signal name
into a normalized form.

> btw2: Is there a possibility to get all signals from an object?

I quick browse through Qt documentation didn't reveal anything. 

Andreas

-- 
You love your home and want it to be beautiful.




More information about the PyQt mailing list