Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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:

enter image description here

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) ...

like image 416
Lieuwe Avatar asked Feb 07 '13 18:02

Lieuwe


Video Answer


2 Answers

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.

like image 145
Daniel Hedberg Avatar answered Sep 18 '22 22:09

Daniel Hedberg


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

like image 22
Lieuwe Avatar answered Sep 16 '22 22:09

Lieuwe