PDA

View Full Version : I beg your assistance: QListView does not work



azdruid
9th January 2008, 12:26
So: I have a model, which is a subclass of QAbstractListModel. It implements rowCount() and data(), both of which work fine. Alas, when I try to use this model to feed a QListView, however, nothing shows up.

The QListView is empty.

Naturally, this is extremely perplexing, and I am feeling quite frustrated. Any thoughts on the matter, please?

Thank you very, very much in advance.

jacek
9th January 2008, 15:07
Are these the only methods you have implemented?

You can try this: http://labs.trolltech.com/page/Projects/Itemview/Modeltest

jpn
9th January 2008, 16:06
Do you create the model with keyword "new"?

jacek
9th January 2008, 16:48
Do you create the model with keyword "new"?
Good question! :)

azdruid
11th January 2008, 12:18
Oops! I'm an idiot. I didn't have data() returning a new QVariant() for all other roles besides DataRole, because I didn't think they mattered. But they do!

I am enlightened now. Thank you for the assistance anyhow, folks.