Reputation: 391
I have a QTableWidget with 7 colums in a QDialog, where every row has information about files in a specific directory. With some checkboxes, lineedits etc I want to have the possibility to show only those files with a certain text, which I can manually add in the lineEdit.
Is it somehow possible to check every row, if it contains the lineEdit-text and if not to hide the row (without changing any index of the other rows, that I dont have to hide)?
Upvotes: 9
Views: 11394
Reputation: 391
For people who need this possibility, it is quite easy, I do it like this:
for(int i=0; i<tableWidget->rowCount(); i++)
{
if(lineEdit->text() != tableWidget->(i, 0)->text())
{
tableWidget->hideRow(i);
}
}
Upvotes: 10