you may store your sqlRecord to QVariantList which will reduce your time to fetch data from database every time.
This will help you if you want to ONE TIME FETCH data from database.
Storing data to array will not keep the track of the data.
So store all the QSqlRecorddata in QVariantMap,
And append the Map in QVariantList :: 
QVariantMap myClass
::record2map(const QSqlRecord &record
){
QVariantMap map;
for(int index = 0; index < record.count(); ++index) {
QString key
= record.
fieldName(index
);
map.insert(key, value);
}
return map;
}
QVariantMap myClass::record2map(const QSqlRecord &record)
{
QVariantMap map;
for(int index = 0; index < record.count(); ++index) {
QString key = record.fieldName(index);
QVariant value = record.value(index);
map.insert(key, value);
}
return map;
}
To copy to clipboard, switch view to plain text mode
CHEERS..
!!!
Bookmarks