[Qt-interest] QListView's selectionModel is broken?

Jesús Fernández jsfdez at gmail.com
Tue Mar 17 17:44:39 CET 2009


Try QItemSelectionModel::selectionChanged instead

2009/3/17 Ellen Kestrel <dragonflykes at gmail.com>

> I have a QListView which has its data supplied by a QStringListModel, and I
> want to display information when each item in the QListView is clicked.  So,
> I tried
>
> connect (listView->selectionModel (), SIGNAL (currentChanged (const
> QModelIndex&, const QModelIndex&)), this, SLOT (display ()));
>
> When I run the program, the slot is never run.  There are no "No such
> signal/slot" messages - it looks like the currentChanged signal is simply
> never emitted.  I have done the exact same thing with a QTreeView, and it
> worked exactly the way I wanted it to.  I also tried connecting the
> currentRowChanged and selectionChanged signals, but those didn't work
> either.  Is there something special you have to do with a QListView, or is
> this a bug?  If it's a bug, is there a way to work around it?
>
> -- EK
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090317/902a0cc2/attachment.html 


More information about the Qt-interest-old mailing list