Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to perform search in QTableWidget?
I want to perform a search operation in a table widget and want to highlight the row which contains particular word(key used for searching).
Please somebody tell me is that possible?
goetz last edited by
You can use "QTableWidget::findItems() ":/doc/qt-4.8/qtablewidget.html#findItems to find the matching items and "QTableWidgetItem::setBackground() ":/doc/qt-4.8/qtablewidgetitem.html#setBackground to change the background color of the item.
Thank u Volker....
I did like this...
QList<QTableWidgetItem *> LTempTable =temp->findItems("001",Qt::MatchEndsWith);
cout<<"the matched count:"<<LTempTable.count()<<endl;
it was highlighting only that particular item, i want to highlight whole row,....please tell how to do that?
andre last edited by
For each of the found items, also highlight the other cells on that row? It should be easy to find these other cells in the row, as the QTableWidgetItem rowPtr contains the row number you need to find the other items on the row.
ok thank u...:)