[Qt-interest] QListWidget clicked() signal
Martin Fiala
fialkam at gmail.com
Sun Mar 8 15:09:07 CET 2009
Thank you very much for the reply.
So, just to be absolutely sure, there isn't any signal that is emitted
when the widget is clicked or activated? I don't really need to know
if there was an item clicked or which one was clicked etc.. Just to
know which of the two widgets was clicked... It just seems
unbelieavable to me as I can see the widget react on the click even if
there are no items (the frame of widget changes)..
If so I might have to look into those overloads......
Thanks again for your quick response.
Martin
On Sun, Mar 8, 2009 at 2:23 PM, Scott Aron Bloom
<Scott.Bloom at sabgroup.com> wrote:
> The issue is your looking for a signal on an item click, and no item is
> visible.
>
> What you need to do, is on the view, overload the generic
> mouseReleaseEvent and work from there...
>
> Take a look at the QListView class to see how its implemented (it may be
> in QAbstractItemView using "item for cursor" functions), but the net
> result, somewhere there is code that is ignoring the click when the
> cursor is not on an item.
>
> Scott
>
> -----Original Message-----
> From: qt-interest-bounces at trolltech.com
> [mailto:qt-interest-bounces at trolltech.com] On Behalf Of Martin Fiala
> Sent: Sunday, March 08, 2009 5:56 AM
> To: qt-interest at trolltech.com
> Subject: [Qt-interest] QListWidget clicked() signal
>
> 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. itemClicked is emitted only if
> there are items inside and clicked, so that will not work for me :(.
> I searched a bit around and found out that QListWidget inherits
> signals from QAbstractItemView... There exists a clicked (const
> QModelIndex & index) slot but I've never managed to actually make it
> work, so I'm not sure it is inherited. Anyone can help me with this?
> I've tried clicked(), and clicked( My_listWidget..model()) and
> clicked(My_listWidget.rootIndex()) but I get "No such signal.." for
> all of them.. So I'm either supplying wrong QModelIndex or there is no
> such signal for QListWidget. Either way, can someone advice me, how to
> make a such a signal/functionality?
>
> Thanks in advance for any info.
> Martin Fiala
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
More information about the Qt-interest-old
mailing list