PDA

View Full Version : how to get complete row from qtable widget?



aurora
9th January 2012, 11:19
Im performing search operation on a tablewidget.(using search key)
Highlighted found key in the table widget.
Now i want to update the table, which contains only those rows which has search key.

Now i already highlighted the found search key, but i'm unable to fetch whole row which contains the search key.
Please tell me how can i get that particular row, which contain that search key?


QString SearchKey=ui->lineEdit_key->text();
QList<QTableWidgetItem *> LTempTable =temp->findItems(SearchKey,Qt::MatchExactly);


cout<<"the matched count:"<<LTempTable.count()<<endl;
foreach(rowPtr,LTempTable)
{
rowPtr->setBackground(Qt::red);
int rowNo=temp->row(rowPtr);
cout<<"THE ROW NUMBER IS:"<<rowNo<<endl; <-----getting row number but how can i get complete row?

}
}

wysota
9th January 2012, 12:19
rowPtr contains the row data for each row found. Just ask it for the data you want.

aurora
10th January 2012, 10:20
Ok thanks ..:)