PDA

View Full Version : Qtableview column get increasing



maarvi
28th June 2011, 19:21
hello every one i have i have drag and dropped a tableview and write following code the code


QStandardItemModel *listmodel = new QStandardItemModel(this);
QStandardItem * root = listmodel->invisibleRootItem()
QList<QStandardItem *> row;
for(int i =0;i<5 ;i++)
{
row << new QStandardItem("col1") << new QStandardItem("col2") << new QStandardItem("col3") ;
root->appendRow(row);

}

ui->tableView->setModel(listmodel);

but the problem is that my column get increaed ist they are 3 then 6 then 9 i want column to be 3 what should i do kindly help me

Added after 27 minutes:

it worked i just added root->clear() :)