In my application, I have QTableWidget displaying multiple rows, a line edit to enter a string and a push button.
The requirement says, upon clicking on the push button, the same QTableWidget should show only rows which contain the string entered into the line edit.
I thought of using a QSortFilterProxyModel, but QTableWidget has setModel(...) method private, so I am unable to use QSortFilterProxyModel in this case.
Using a sort/filter proxy is probably overkill for this anyway.
It’s a matter of iterating through all of your QTableWidgetItem objects, determining if their text matches the filter and calling QTableView::setRowHidden() as needed.
For example: