What happened to QListViewItem in qt4?

I don't do a lot of Qt programming so this may sound like a silly question, but what happened to QListViewItem in qt4?

I have this application I wrote some time ago in qt3. I changed that to qt4 using the aptly name "qt3toqt4" program (all this on a Fedora platform).

Internally it seems to change a lot of classes from QClass to Q3Class (probably to provide some sort of backwards compatibility) and then compile it with qt4. I had some problems with it today (to do with reading stdout from a QProcess, but that aside) and I decided to simply rewrite the application in qt4.

Now for the problem - I use a QListView and to this I add loads of QListViewItems in a tree like structure. Something like this:

But that doesn't seem to be available anymore in qt4. And I can't find any examples that provide this behaviour either. Is there a way to do this in qt4? To maybe make it more complicated - I used my own QListViewItems (derived from QListViewItem) ...


The widget you are looking for in Qt 4 is QListWidget and its item class QListWidgetItem . It pretty much corresponds to the QListView widget in Qt 3 with a classic item-based interface for adding and removing items. You can subclass QListWidgetItem just as you subclassed QListViewItem in Qt 3.


Just to complete this question. It is QTreeWidget and QTreeWidgetItem that implement this behaviour in qt4.

链接地址: http://www.djcxy.com/p/69164.html

上一篇: Erlang的“系统”内存部分不断增长

下一篇: qt4中的QListViewItem发生了什么?