View Full Version : How to port QListBox and QListBoxItem in Qtopia 2.2.0 to 4.2.0

22nd October 2007, 15:28
Hi guys,

Have someone tried this?

22nd October 2007, 18:18
What's there to try? QListBox equivalent in Qt4 is QListWidget. The API doesn't differ that much, so it should be easy for you to port it.

23rd October 2007, 01:34
The problem here is with QListBoxItem. In 2.2.0, I use my own class inherits from QListBoxItem, and I re-implement its paint. So what's QListBoxItem in 4.4.0?

23rd October 2007, 08:13
QListWidgetItem. Please at least take a look at QListWidget docs before asking such questions...

24th October 2007, 03:22
I don't think you got my question or because of my poor English.

If you inherits QListBoxItem, unless you re-implement paint(), you will always get a compilation error. And by using paint(), you could custom the item's view.

Have a look at call history application in Qtopia 2.2.0. For each item, it has two rows to display in different fonts. Show me, how you implement this using QListWidgetItem in Qtopia 4.2.0

24th October 2007, 08:04
The looks of items in Qt4 are controled by an entity called the delegate. If you want to customize how an item gets rendered, you need to subclass QItemDelegate or QAbstractItemDelegate. But if you only need simple customization, it is possible you can do it without a custom delegate. So the basic question is - how do you want your item to look like? I suggest you read the docs about model-view programming: http://doc.trolltech.com/latest/model-view-programming.html