title: filter QSqlRelationalTableModel with setFilter function to show only items that contains a specific tag/tags
body: <p>I have an <code>SQLITE</code> Database with the following tables</p>
  
  <pre><code>items(item_id,item_name,....);
  tags(tag_id,tag_name);
  items_tags(item_id,tag_id);
  </code></pre>
  
  <p>I'm using <code>QSqlRelationalTableModel</code> class to for the items table.</p>
  
  <p>this class have this function <code>QSqlTableModel::setFilter(const QString &amp;filter);</code></p>
  
  <p>The filter is a SQL WHERE clause without the keyword WHERE</p>
  
  <p>for example: setFilter("item_name=arg");</p>
  
  <p>what I want to do is to use the setFilter function to select only items with a specific tag/tags.</p>
  
  <p>since I can only use the <code>setFilter(QString &amp;Filter)</code> function which is basically a WHERE clause</p>
  
  <p>I found this solution which I think is a bad one</p>
  
  <p>I'll use this filter</p>
  
  <pre><code>setFilter(FilterString);
  
  
  FilterString="item_id=arg1 or item_id=arg2 or item_id=argX or......"
  </code></pre>
  
  <p>the IDs will be obtained from this query</p>
  
  <pre><code>Query.prepare("select item_id from items_tags where tag_id=?");
  </code></pre>
  
  <p>the FilterString will be generated and incremented by a (do while loop) using <code>Query.next()</code> function that will loop over the resulted Query IDs</p>
  
  <pre><code>FilterString+="item=Query.value(item_id).toString();
  </code></pre>
  
  <p>and use like 2 if statements to determine when to add the <code>or</code> clause to the <code>FilterString</code></p>
  
  <p>this solution will definitely work but I think it's stupid because if there are many tagged items(say 5000) the Query string will contain 4999 <code>or</code> clause and another 5000 <code>"id=x"</code> so the Query will be more than 10000 characters long.</p>
  
  <p>QString object can contain a lot more characters but is this Query will have a big impact on performance ?</p>
  
  <p>what are the other alternatives, Even if it requires to switch to another DB like ORACLE or Mysql since SQLITE doesn't have many internal features</p>