[Qt-interest] QListWidget clicked() signal

Andreas Pakulat apaku at gmx.de
Sun Mar 8 15:07:45 CET 2009


On 08.03.09 13:55:37, Martin Fiala wrote:
> Hello,
> first, I'm new to this list, so hello everyone.
> I've found many answers here before, but not to this one:
> 
> I'm using two QListWidget items in my form and want to add a signal to
> each, that calls some function when the Widget is clicked. Sounds
> pretty easy, but unfortunately, isn't. So far I was able to manage
> with itemClicked signal, but the problem is, I need the signal to be
> emitted even if the list is empty.

Then you probably need to subclass QListWidget and override the
mouseReleaseEvent() method. That one will be called when a mouse button was
released.  Make sure to accept the event you get when you've done your
custom mouse-click handling and also that you call the superclass
implementation when you don't want to do custom mouse-click handling (for
example if the widget does have items).

Andreas

-- 
Stay away from flying saucers today.



More information about the Qt-interest-old mailing list