PDA

View Full Version : Filter a Filtered QSortFilterProxyModel !?



solook
24th October 2011, 21:47
hi...

i want to filter a filtered QSortFilterProxyModel..

for example items such this :

proxyModel items =
"123a"
"1234a"
"12345"
"1234567"
"12345678a"
....
result proxyModel->setFilterRegExp(regExp("12345")) =

"12345"
"1234567"
"12345678a"

now i want to filter just tree above item with proxyModel->setFilterRegExp(regExp("a"))

i want the result just be "12345678a" no "1234a" and "12345678a"

d_stranz
25th October 2011, 05:17
So what are you asking for? The correct QRegExp to use? How to chain together multiple QSortFilterProxyModels? What?

solook
25th October 2011, 05:34
So what are you asking for? The correct QRegExp to use? How to chain together multiple QSortFilterProxyModels? What?



i want to have advansed search like google search.. and , or , unwanted word..

for and i use this \bword1\b.+\bword2\b

it just find :
word1 some word2
and not find :
word2 some word1

whereas i want to find both..

d_stranz
25th October 2011, 19:46
Then you need to have a QRegExp that contains the logical OR of both forms of your search phrase:

(word1 some word2) | (word2 some word1)

solook
25th October 2011, 20:22
this way is good for just tow word :
the code must be :
(\bword1\b.+\bword2\b|\bword2\b.+\bword1\b)

so for tree word :

(\bword1\b.+\bword2\b.+\bword3\b|\bword1\b.+\bword 3\b.+\bword2\b|\bword2\b.+\bword3\b.+\bword1\b|\bw ord2\b.+\bword1\b.+\bword3\b|\bword3\b.+\bword2\b. +\bword1\b|\bword3\b.+\bword1\b.+\bword2\b)

i think this way for tree or more word is not good..
..