[SOLVED] Searching a string in a QtableView or QStandardItemModel
-
Hi,
Actually i wanted to do it using QSortFilterProxyModel. Kindly rectify what is wrong :@QString input = findstring->text().trimmed();
QSortFilterProxyModel proxy;
proxy.setSourceModel(mytablemodel);
proxy.setFilterFixedString(input);int num_rows = mytablemodel->rowCount(); int num_cols = mytablemodel->columnCount(); QModelIndex matchingIndex = proxy.mapFromSource(proxy.index(num_rows,num_cols)); if(matchingIndex.isValid()) { QMessageBox::information(this, "Find", "Found"); } else { QMessageBox::information(this, "Find", "Not Found"); }
@
I am setting the index incorrectly i guess. How to browse the entire table ?
I truely appreciate your help.