[Qt-interest] QListWidget clicked() signal

Martin Fiala fialkam at gmail.com
Sun Mar 8 13:55:37 CET 2009


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



More information about the Qt-interest-old mailing list