views:

134

answers:

1

I'm fairly new to Qt4.5, and I'm unsure of the approach I should take to the following problem.

I'm trying to create a QListWidget style widget, that can dynamically expand to an arbitrary length, probably no more than 300 elements. I tried to use the QListWidget, but I need to store three QStrings per line, and QListWidget is fairly limited in that regard. I need to be able to add, edit and delete lines. Sorting is not necessary.

I tried to use QTableWidget, but it's not fitting the bill either. I could make it work, but it would be an ugly hack.

I've tried to 'roll my own' version of QListWidget, but with three QStrings, rather than one, but it's a tedious procedure. Doable though.

My Question is this, should I go with the last option, or is there a better approach? I've been browsing through Trolltech's documentation, but there's a lot there, and the stuff I've done so for has been unsuccessful (obviously).

Any recommendations? Thanks in advance!

+2  A: 

That sounds like a table. 300 rows and 3 columns. If that indeed is the case you should retry using the QTableWidget. (Preferably without any hacks.)

If you're trying to do something else, (Can't quite imagine what.) you should try QTableView combined with a QAbstractTableModel that you subclass to provide the content.

Georg