<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    what kind of model you implementing? files model and abstract data
    model solutions can be differ<br>
    <br>
    <div class="moz-cite-prefix">On 16.03.2014 11:37, Tomek wrote:<br>
    </div>
    <blockquote
      cite="mid:305FDE3A-9D82-4DDB-BFA6-A4E5CD28A28F@tdress.de"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html;
        charset=ISO-8859-1">
      I am wondering how I could display a single ListModel in multiple
      SilicaGridViews (filtered)?
      <div>Simply making an item invisible in a specific view does not
        work, because it still consumes (<span style="color: rgb(128, 0,
          0);">cellWidth </span>x <span style="color: rgb(128, 0, 0);"> </span><span
          style="color: rgb(128, 0, 0);">cellHeight</span>) the space.</div>
      <div>
        <pre style="margin-top: 0px; margin-bottom: 0px;">
</pre>
        <div>
          <div>I know, I could also implement my own model in c++.
            Probably something like this was done my someone already? </div>
          <div><br>
          </div>
          <div><br>
          </div>
          <div>Currently, I am experimenting with multiple models which
            I need to keep in sync (implementation is far from ready
            ;)).</div>
          <div>[FilteredListModel.qml]</div>
          <div>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(128, 128, 0);">import</span><span style="color: rgb(192, 192, 192);"> </span>QtQuick<span style="color: rgb(192, 192, 192);"> </span>2.0</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(128, 128, 0);">import</span><span style="color: rgb(192, 192, 192);"> </span>Sailfish.Silica<span style="color: rgb(192, 192, 192);"> </span>1.0</pre><div>
</div></pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;">
</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(128, 0, 128);">Item</span><span style="color: rgb(192, 192, 192);"> </span>{</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 128, 0);">property</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">ListModel</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 0);">filteredModel</span>:<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic;">_filteredModel</span></pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 128, 0);">property</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">ListModel</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 0);">model</span>:<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic;">_model</span></pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 128, 0);">property</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 128, 0);">string</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 0);">filterRoleName</span></pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 128, 0);">property</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 128, 0);">var</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 0);">filterValue</span></pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;">
</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 0, 128);">ListModel</span><span style="color: rgb(192, 192, 192);"> </span>{</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span><span style="color: rgb(128, 0, 0);">id</span>:<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic;">_filteredModel</span></pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span>}</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;">
</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 0, 128);">ListModel</span><span style="color: rgb(192, 192, 192);"> </span>{</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span><span style="color: rgb(128, 0, 0);">id</span>:<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic;">_model</span></pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;">
</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span><span style="color: rgb(128, 0, 0);">onRowsInserted</span>:<span style="color: rgb(192, 192, 192);"> </span>{</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">            </span><span style="color: rgb(128, 128, 0);">for</span><span style="color: rgb(192, 192, 192);"> </span>(<span style="color: rgb(128, 128, 0);">var</span><span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic; color: rgb(41, 133, 199);">i</span><span style="color: rgb(192, 192, 192);"> </span>=<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic; color: rgb(41, 133, 199);">first</span>;<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic; color: rgb(41, 133, 199);">i</span><span style="color: rgb(192, 192, 192);"> </span><=<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic; color: rgb(41, 133, 199);">last</span>;<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic; color: rgb(41, 133, 199);">i</span>++)<span style="color: rgb(192,
 192, 192);"> </span>{</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;">
</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">                </span><span style="color: rgb(128, 128, 0);">var</span><span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic; color: rgb(41, 133, 199);">entry</span><span style="color: rgb(192, 192, 192);"> </span>=<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic;">model</span>.get(<span style="font-style: italic; color: rgb(41, 133, 199);">i</span>);</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">                </span><span style="color: rgb(128, 128, 0);">if</span><span style="color: rgb(192, 192, 192);"> </span>(<span style="font-style: italic; color: rgb(41, 133, 199);">entry</span>[<span style="font-style: italic;">filterRoleName</span>]<span style="color: rgb(192, 192, 192);"> </span>===<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic;">filterValue</span>)</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">                </span>{</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">                  </span><span style="font-style: italic;">_filteredModel</span>.append(<span style="font-style: italic; color: rgb(41, 133, 199);">entry</span>);</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">                </span>}</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">            </span>}</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span>}</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;">
</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span><span style="color: rgb(128, 0, 0);">onRowsRemoved</span>:<span style="color: rgb(192, 192, 192);"> </span>{</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">             </span><span style="color: rgb(128, 128, 0);">for</span><span style="color: rgb(192, 192, 192);"> </span>(<span style="color: rgb(128, 128, 0);">var</span><span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic; color: rgb(41, 133, 199);">i</span><span style="color: rgb(192, 192, 192);"> </span>=<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic; color: rgb(41, 133, 199);">first</span>;<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic; color: rgb(41, 133, 199);">i</span><span style="color: rgb(192, 192, 192);"> </span><=<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic; color: rgb(41, 133, 199);">last</span>;<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic; color: rgb(41, 133, 199);">i</span>++)<span style="color: rgb(192
, 192, 192);"> </span>{</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">                </span><span style="font-style: italic;">_filteredModel</span>.remove(<span style="font-style: italic; color: rgb(41, 133, 199);">i</span>);</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">             </span>}</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span>}</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span>}</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;">
</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 128, 0);">function</span><span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic;">append</span>(sobject)</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span>{</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span><span style="font-style: italic;">model</span>.append(<span style="font-style: italic; color: rgb(41, 133, 199);">sobject</span>);</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span>}</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;">
</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 128, 0);">function</span><span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic;">setProperty</span>(index,<span style="color: rgb(192, 192, 192);"> </span>key,<span style="color: rgb(192, 192, 192);"> </span>value<span style="color: rgb(192, 192, 192);"> </span>)</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span>{</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span><span style="font-style: italic;">model</span>.setProperty(<span style="font-style: italic; color: rgb(41, 133, 199);">index</span>,<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic; color: rgb(41, 133, 199);">key</span>,<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic; color: rgb(41, 133, 199);">value</span>);</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span><span style="color: rgb(128, 128, 0);">var</span><span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic; color: rgb(41, 133, 199);">entry</span><span style="color: rgb(192, 192, 192);"> </span>=<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic;">model</span>.get(<span style="font-style: italic; color: rgb(41, 133, 199);">index</span>);</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;">
</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span><span style="color: rgb(128, 128, 0);">if</span><span style="color: rgb(192, 192, 192);"> </span>(<span style="font-style: italic; color: rgb(41, 133, 199);">entry</span>[<span style="font-style: italic;">filterRoleName</span>]<span style="color: rgb(192, 192, 192);"> </span>===<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic;">filterValue</span>)</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span>{</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">            </span><span style="font-style: italic;">_filteredModel</span>.set(<span style="font-style: italic; color: rgb(41, 133, 199);">index</span>,<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic;">model</span>.get(<span style="font-style: italic; color: rgb(41, 133, 199);">index</span>))</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span>}</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span><span style="color: rgb(128, 128, 0);">else</span></pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span>{</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">            </span><span style="font-style: italic;">_filteredModel</span>.remove(<span style="font-style: italic; color: rgb(41, 133, 199);">index</span>);</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span>}</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span>}</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;">
</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 128, 0);">function</span><span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic;">remove</span>(index)</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span>{</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span><span style="font-style: italic;">model</span>.remove(<span style="font-style: italic; color: rgb(41, 133, 199);">index</span>);</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span>}</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;">
</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span><span style="color: rgb(128, 0, 0);">Component.onCompleted</span>:<span style="color: rgb(192, 192, 192);"> </span>{</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span><span style="font-style: italic;">model</span>.append({<span style="color: rgb(0, 128, 0);">"name"</span>:<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"Apple"</span>,<span style="color: rgb(0, 128, 0);">"cost"</span>:<span style="color: rgb(192, 192, 192);"> </span>0.25,active:<span style="color: rgb(192, 192, 192);"> </span>false});</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span><span style="font-style: italic;">model</span>.append({<span style="color: rgb(0, 128, 0);">"name"</span>:<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"Orange"</span>,<span style="color: rgb(0, 128, 0);">"cost"</span>:<span style="color: rgb(192, 192, 192);"> </span>0.90,active:<span style="color: rgb(192, 192, 192);"> </span>true});</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span><span style="font-style: italic;">model</span>.append({<span style="color: rgb(0, 128, 0);">"name"</span>:<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"Bannana"</span>,<span style="color: rgb(0, 128, 0);">"cost"</span>:<span style="color: rgb(192, 192, 192);"> </span>0.30,active:<span style="color: rgb(192, 192, 192);"> </span>true});</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">        </span><span style="font-style: italic;">model</span>.append({<span style="color: rgb(0, 128, 0);">"name"</span>:<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"Ananas"</span>,<span style="color: rgb(0, 128, 0);">"cost"</span>:<span style="color: rgb(192, 192, 192);"> </span>3.10,active:<span style="color: rgb(192, 192, 192);"> </span>true});</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(192, 192, 192);">    </span>}</pre>
            <pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
          </div>
        </div>
      </div>
      <div><br>
      </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
SailfishOS.org Devel mailing list</pre>
    </blockquote>
    <br>
  </body>
</html>