PDA

View Full Version : QtableView Crash



rex
22nd December 2010, 13:49
Hello friends.. i am stuck with a small problem.. i have like some 500 channels of data which i have saved in the data base.. now i wanted to display some channels of data which are selected in a QTableView. I am retrieving all the data from the db, i am trying to append 640 channels of data and then i have a index position of the selected channels i thought i will displayed them with the help of the index number. But the program crash's.. not even able to append data into the tepdata and the TableView jus't freezes it does't update any data.. :(


tepdata.resize(500);
QSqlQuery sq1("select * from thdata");
if(sq1.exec())
{
if (sq1.first())
{
do
{
for (int i = 0; i < tepdata.size(); ++i)
{
tepdata.push_back(sq1.value(i).toString());
}
} while(sq1.next());
}

}
this is the code where i am trying to update into the Table View.. but nothing happens

QStandardItemModel *model ;
model = new QStandardItemModel();
model->clear();
for(int k=0;k< tepdata.count(); k++)
{
QStandardItem *item2 = new QStandardItem(tepdata.at(k));
model->setItem(j, 2, item2);
}

thank you