Git commit f80ea56a5546d8419f25e55ce1bfec843e0c4488 by Stephane Mankowski. Committed on 01/04/2015 at 14:26. Pushed by smankowski into branch 'master'.
BUG:345719 Enhance fast search/filter on lists M +17 -4 doc/index.docbook M +1 -1 skgbasegui/skgfilteredtableview.ui M +4 -2 tests/skgbasemodelertest/skgtestbase.cpp http://commits.kde.org/skrooge/f80ea56a5546d8419f25e55ce1bfec843e0c4488 diff --git a/doc/index.docbook b/doc/index.docbook index 75b5cc0..0c57c98 100644 --- a/doc/index.docbook +++ b/doc/index.docbook @@ -578,11 +578,24 @@ </para> <tip> <para> - The filtering string could be complex, some examples are better to explain: + The filtering string follows these rules:, + <itemizedlist> + <listitem><para>Searching is case-insensitive. So table, Table, and TABLE are all the same.</para></listitem> + <listitem><para>If you just put a word or series of words in the search box, the application will filter the table to keep all lines having these words (logical operator AND).</para></listitem> + <listitem><para>If you want to add (logical operator OR) some line, you must prefix your word by "+".</para></listitem> + <listitem><para>If you want to remove (logical operator NOT) some line, you must prefix your word by "-".</para></listitem> + <listitem><para>If you want to search only on one column, you must prefix your word by the column name like: col1:word.</para></listitem> + <listitem><para>If you want to use the character ":" in value, you must specify the column name like this: col1:value:rest.</para></listitem> + <listitem><para>If you want to search for a phrase or something that contains spaces, you must put it in quotes, like: "yes, this is a phrase".</para></listitem> + </itemizedlist> + + Some examples are better to explain: <itemizedlist> - <listitem><para>"deposit auto" will keep all lines containing the words deposit AND auto</para></listitem> - <listitem><para>"deposit +auto" will keep all lines containing deposit AND lines containing auto</para></listitem> - <listitem><para>"deposit -auto" will keep all lines containing deposit but NOT auto</para></listitem> + <listitem><para>+val1 +val2 => Keep lines containing val1 OR val2</para></listitem> + <listitem><para>+val1 -val2 => Keep lines containing val1 but NOT val2</para></listitem> + <listitem><para>"abc def" => Keep lines containing the sentense "abc def"</para></listitem> + <listitem><para>abc:def => Keep lines having a column name starting by abc and containing def</para></listitem> + <listitem><para>:abc:def => Keep lines containing "abc:def"</para></listitem> </itemizedlist> </para> </tip> diff --git a/skgbasegui/skgfilteredtableview.ui b/skgbasegui/skgfilteredtableview.ui index 516046e..c225272 100644 --- a/skgbasegui/skgfilteredtableview.ui +++ b/skgbasegui/skgfilteredtableview.ui @@ -101,7 +101,7 @@ <enum>Qt::WheelFocus</enum> </property> <property name="toolTip"> - <string><html><head/><body><p>If you just put a word or series of words in the search box, the application will filter the table to keep all lines having these words (logical operator AND). </p><p>If you want to add (logical operator OR) some line, you must prefix your word by &quot;+&quot;.</p><p>If you want to remove (logical operator NOT) some line, you must prefix your word by &quot;-&quot;.</p><p>If you want to search only on one column, you must prefix your word by the column name like: col1:word.</p><p>Searching is case-insensitive. So table, Table, and TABLE are all the same. </p><p>If you want to search for a phrase or something that contains spaces, you must put it in quotes, like: &quot;yes, this is a phrase&quot;.</p><p>Examples:</p><p>+val1 +val2 =&gt; Keep lines containing val1 OR val2</p><p>+val1 -val2 =&gt; Keep lines containing val1 but NOT val2</p><p>&quot;abc def&quot; =&gt; Keep lines containing the sentense &quot;abc def&quot; </p><p>abc:def =&gt; Keep lines having a column name starting by abc and containing def</p></body></html></string> + <string><html><head/><body><p>Searching is case-insensitive. So table, Table, and TABLE are all the same.<br/>If you just put a word or series of words in the search box, the application will filter the table to keep all lines having these words (logical operator AND). <br/>If you want to add (logical operator OR) some line, you must prefix your word by &quot;+&quot;.<br/>If you want to remove (logical operator NOT) some line, you must prefix your word by &quot;-&quot;.<br/>If you want to search only on one column, you must prefix your word by the column name like: col1:word.</p><p>If you want to use the character &quot;:&quot; in value, you must specify the column name like this: col1:value:rest.<br/>If you want to search for a phrase or something that contains spaces, you must put it in quotes, like: &quot;yes, this is a phrase&quot;.</p><p><span style=" font-weight:600; text-decoration: underline;">Examples:</span><br/>+val1 +val2 =&gt; Keep lines containing val1 OR val2<br/>+val1 -val2 =&gt; Keep lines containing val1 but NOT val2<br/>&quot;abc def&quot; =&gt; Keep lines containing the sentense &quot;abc def&quot; <br/>abc:def =&gt; Keep lines having a column name starting by abc and containing def<br/>:abc:def =&gt; Keep lines containing &quot;abc:def&quot;</p></body></html></string> </property> </widget> </item> diff --git a/tests/skgbasemodelertest/skgtestbase.cpp b/tests/skgbasemodelertest/skgtestbase.cpp index 9e58c9d..2dfb904 100644 --- a/tests/skgbasemodelertest/skgtestbase.cpp +++ b/tests/skgbasemodelertest/skgtestbase.cpp @@ -394,10 +394,12 @@ int main(int argc, char** argv) SKGTEST("STR:splitCSVLine", parameters[0], "A"); SKGTEST("STR:splitCSVLine", parameters[1], "\"B\";\"C\""); - parameters = SKGServices::splitCSVLine("+123 -\"abc def\"", ' ', true); - SKGTEST("STR:splitCSVLine count", parameters.count(), 2); + parameters = SKGServices::splitCSVLine("+123 -\"abc def\" \"e:f\" e:f", ' ', true); + SKGTEST("STR:splitCSVLine count", parameters.count(), 4); SKGTEST("STR:splitCSVLine", parameters[0], "+123"); SKGTEST("STR:splitCSVLine", parameters[1], "-abc def"); + SKGTEST("STR:splitCSVLine", parameters[2], "e:f"); + SKGTEST("STR:splitCSVLine", parameters[3], "e:f"); SKGTEST("STR:splitCSVLine words", SKGServices::splitCSVLine("w1 w2", ' ', true).count(), 2); SKGTEST("STR:splitCSVLine words", SKGServices::splitCSVLine("\"w1 w1\"", ' ', true).count(), 1);
