PDA

View Full Version : Help choosing a model type for QTableView



goes2bob
10th March 2008, 00:57
I have been searching forums with no luck trying to find the type of model to use for my custom class. My intent is to use it as a model for a QTableView. First things first. here is what the class looks like (simple - 6 private members):

myClass{
QString mystring;
double myDouble1;
double myDouble2;
double myDouble3;
double myDouble4;
double myDouble5;
}

I would like to construct a model that can hold a few of these "myClass" objects. I have looked at (and tried to implement)QAbstractListModel and looked a little at QAbstractItemModel but don't know which way would be better.??? This will be a read-only model, although I will want to use a couple values from each object when user is done adding all the "myClass" objects they desire.
Thanks in advance - Goes2BoB

jacek
10th March 2008, 02:22
If you want to represent objects as rows and member variables as columns, you need QAbstractTableModel subclass.