QSortFilterProxyModel filter whole word.
For my tableView I am using a QSortFilterModel to which a QRegExp is set
if (isWholeWord) // checkbox for whole words
exp.setPatternSyntax(QRegExp::FixedString); exp.setCaseSensitivity(isCaseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive); m_proxyModel->setFilterRegExp(exp);@
As per the documentation of "QRegExp":http://qt-project.org/doc/qt-5.0/qtcore/qregexp.html it should work , i tried with exp.indexIn(text) and it return 0 but the model does not show anything.
what am I missing ?
since you set the pattern syntax to QRegExp::FixedString it actually tries to find "^bla$".
I think you only want this for your else-case.
Thank you, works perfect !!!
The above implementation worked very well, Since I am using the filterModel on my tableView the regExp is set for the whole cell, this mean if the filter text is "abc" and isWholeWord is true then its filters all the rows that has exact "abc" set for the complete cell.
What I want is it should check if the cell contains the filter text
Eg: Filter Text : Dubai isWholeWord: true
All the rows should be visible that contains Dubai as whole word, how to do that?
if i understood you correct, then just leave out the line