<html><head><meta http-equiv="Content-Type" content="text/html charset=windows-1252"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div apple-content-edited="true">Hi,
</div><div apple-content-edited="true">I just wanted to share my general filter model (implemented in c++, supports flat list only) with the audience.</div><div apple-content-edited="true">It might be a start for someone else’s work.</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">Here is how its used in QML:</div><div apple-content-edited="true"><br></div><div apple-content-edited="true">
<pre style="margin-top: 0px; margin-bottom: 0px;"><!--StartFragment--><span style=" color:#800080;">FilterModel </span>{</pre><pre style="margin-top: 0px; margin-bottom: 0px;"> id:<span style="color: rgb(192, 192, 192);"> </span><span style="font-style: italic;">filterModel</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">roleNames</span>:<span style=" color:#c0c0c0;"> </span>[<span style=" color:#008000;">"caption"</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"isActive"</span>];</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">Component.onCompleted</span>:<span style="color: rgb(192, 192, 192);"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">filterModel</span>.append({<span style=" color:#008000;">"caption"</span>:<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"A"</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"isActive"</span><span style=" color:#c0c0c0;"> </span>:<span style=" color:#c0c0c0;"> </span>true});</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">filterModel</span>.append({<span style=" color:#008000;">"caption"</span>:<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"A"</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"isActive"</span><span style=" color:#c0c0c0;"> </span>:<span style=" color:#c0c0c0;"> </span>true});</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">filterModel</span>.append({<span style=" color:#008000;">"caption"</span>:<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"B"</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"isActive"</span><span style=" color:#c0c0c0;"> </span>:<span style=" color:#c0c0c0;"> </span>true});</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">filterModel</span>.append({<span style=" color:#008000;">"caption"</span>:<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"B"</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"isActive"</span><span style=" color:#c0c0c0;"> </span>:<span style=" color:#c0c0c0;"> </span>true});</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre><pre style="margin-top: 0px; margin-bottom: 0px;">
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800080;">ViewXYZ</span><span style=" color:#c0c0c0;"> </span>{</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><font color="#c0c0c0"> </font><span style=" color:#800000;">model</span>:<span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">filterModel</span></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">delegate</span>:<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 128);">Text</span><span style="color: rgb(192, 192, 192);"> </span>{<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(128, 0, 0);">text</span>:<span style="color: rgb(192, 192, 192);"> </span>caption<span style="color: rgb(192, 192, 192);"> </span>+<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">("</span><span style="color: rgb(192, 192, 192);"> </span>+<span style="color: rgb(192, 192, 192);"> </span>isActive<span style="color: rgb(192, 192, 192);"> </span>+<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">")"</span>}</pre><pre style="margin-top: 0px; margin-bottom: 0px;">}<!--EndFragment--></pre><div><br></div></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><pre style="margin-top: 0px; margin-bottom: 0px;"><!--StartFragment--><span style=" color:#800080;">Button</span><span style=" color:#c0c0c0;"> </span>{</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><font color="#c0c0c0"> </font><span style=" color:#800000;">caption</span>:<span style=" color:#c0c0c0;"> </span><span style="color: rgb(0, 128, 0);">"</span><span style="color: rgb(0, 128, 0);">Add one"</span></pre><pre style="margin-top: 0px; margin-bottom: 0px;"> <span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">onButtonClicked</span>:<span style=" color:#c0c0c0;"> </span>{ <span style="font-style: italic;">filterModel</span>.append({<span style="color: rgb(0, 128, 0);">"caption"</span>:<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"A"</span>,<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"isActive"</span><span style="color: rgb(192, 192, 192);"> </span>:<span style="color: rgb(192, 192, 192);"> </span>false}); }</pre>}</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><pre style="margin-top: 0px; margin-bottom: 0px;"><pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(128, 0, 128);">Button</span><span style="color: rgb(192, 192, 192);"> </span>{</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><font color="#c0c0c0"> </font><span style="color: rgb(128, 0, 0);">caption</span>:<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"</span><span style="color: rgb(0, 128, 0);">Remove last</span><span style="color: rgb(0, 128, 0);">"</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);">onButtonClicked</span>:<span style="color: rgb(192, 192, 192);"> </span>{ <span style="font-style: italic;">filterModel</span>.remove(<span style="font-style: italic;">filterModel</span>.rowCountSource<span style="color: rgb(192, 192, 192);"> </span>-<span style="color: rgb(192, 192, 192);"> </span>1); }</pre>}</pre><div><pre style="margin-top: 0px; margin-bottom: 0px;"><pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(128, 0, 128);">Button</span><span style="color: rgb(192, 192, 192);"> </span>{</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><font color="#c0c0c0"> </font><span style="color: rgb(128, 0, 0);">caption</span>:<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"</span><span style="color: rgb(0, 128, 0);">Modify last</span><span style="color: rgb(0, 128, 0);">"</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);">onButtonClicked</span>:<span style="color: rgb(192, 192, 192);"> </span>{ <span style="font-style: italic;">filterModel</span>.setProperty(<span style="font-style: italic;">filterModel</span>.rowCountSource<span style="color: rgb(192, 192, 192);"> </span>-<span style="color: rgb(192, 192, 192);"> </span>1,<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"caption"</span>,<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"C</span><font color="#008000">“</font>); }</pre>}</pre><div><pre style="margin-top: 0px; margin-bottom: 0px;"><pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(128, 0, 128);">Button</span><span style="color: rgb(192, 192, 192);"> </span>{</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><font color="#c0c0c0"> </font><span style="color: rgb(128, 0, 0);">caption</span>:<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"</span><span style="color: rgb(0, 128, 0);">Add filter</span><span style="color: rgb(0, 128, 0);">"</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);">onButtonClicked</span>:<span style="color: rgb(192, 192, 192);"> </span>{ <span style="font-style: italic;">filterModel</span>.setFilter(<span style="color: rgb(0, 128, 0);">"caption"</span>,<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"A</span><font color="#008000">“</font>); }</pre>}</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><pre style="margin-top: 0px; margin-bottom: 0px;"><pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(128, 0, 128);">Button</span><span style="color: rgb(192, 192, 192);"> </span>{</pre><pre style="margin-top: 0px; margin-bottom: 0px;"><font color="#c0c0c0"> </font><span style="color: rgb(128, 0, 0);">caption</span>:<span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">"</span><span style="color: rgb(0, 128, 0);">Clear filter</span><span style="color: rgb(0, 128, 0);">"</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);">onButtonClicked</span>:<span style="color: rgb(192, 192, 192);"> </span>{ <span style="font-style: italic;">filterModel</span>.clearFilter(); }</pre>}</pre><div><br></div></pre></div></div></pre></div><div apple-content-edited="true"><br></div><div apple-content-edited="true"><pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">--------------------------------------------------------------------------------------------------------------------</span></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">filtermodel.h</span></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">--------------------------------------------------------------------------------------------------------------------</span></pre></div><div apple-content-edited="true">
<pre style="margin-top: 0px; margin-bottom: 0px;"><!--StartFragment--><span style=" color:#000080;">#ifndef</span><span style=" color:#c0c0c0;"> </span>FILTERMODEL_H</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#define</span><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">FILTERMODEL_H</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;"><QSortFilterProxyModel></span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;"><QAbstractItemModel></span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;"><QModelIndex></span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;"><QHash></span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;"><QByteArray></span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;"><QString></span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;"><QVariant></span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;"><QVariantList></span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;"><QVariantMap></span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">class</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span>:<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">public</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QAbstractItemModel</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">Q_OBJECT</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">public</span>:</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">explicit</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span>(<span style=" color:#800080;">QObject</span><span style=" color:#c0c0c0;"> </span>*parent<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>~<span style="font-style: italic;">ListModelPrivate</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span>setRoleNameList(<span style=" color:#800080;">QVariantList</span><span style=" color:#c0c0c0;"> </span>variantList);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QHash</span><<span style=" color:#808000;">int</span>,<span style=" color:#800080;">QByteArray</span>><span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">roleNames</span>()<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">parent</span>(<span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span>&child)<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">index</span>(<span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>row,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>column,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span>&parent<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span>())<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">rowCount</span>(<span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span>&parent<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span>())<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">columnCount</span>(<span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span>&parent<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span>())<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span>append(<span style=" color:#800080;">QVariantMap</span><span style=" color:#c0c0c0;"> </span>variantMap);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span>remove(<span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>i);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span>setProperty(<span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>i,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>roleName,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariant</span><span style=" color:#c0c0c0;"> </span>data);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariant</span><span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">data</span>(<span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span>&index,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>role)<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>roleFromRoleName(<span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>roleName)<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">private</span>:</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QHash</span><<span style=" color:#808000;">int</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QByteArray</span>><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_roleNames</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QHash</span><<span style=" color:#800080;">QByteArray</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span>><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_roleNamesReverse</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QList</span><<span style=" color:#800080;">QMap</span><<span style=" color:#800080;">QByteArray</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariant</span>><span style=" color:#c0c0c0;"> </span>>*<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_dataList</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">};</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">class</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">FilterModel</span>:<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">public</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QSortFilterProxyModel</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">Q_OBJECT</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">Q_PROPERTY</span>(<span style=" color:#800080;">QVariantList</span><span style=" color:#c0c0c0;"> </span>roleNames<span style=" color:#c0c0c0;"> </span>READ<span style=" color:#c0c0c0;"> </span>roleNameList<span style=" color:#c0c0c0;"> </span>WRITE<span style=" color:#c0c0c0;"> </span>setRoleNameList<span style=" color:#c0c0c0;"> </span>NOTIFY<span style=" color:#c0c0c0;"> </span>roleNameListChanged)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">Q_PROPERTY</span>(<span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>rowCountSource<span style=" color:#c0c0c0;"> </span>READ<span style=" color:#c0c0c0;"> </span>rowCountSource)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">public</span>:</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">FilterModel</span>(<span style=" color:#800080;">QObject</span><span style=" color:#c0c0c0;"> </span>*parent<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>~<span style="font-style: italic;">FilterModel</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QHash</span><<span style=" color:#808000;">int</span>,<span style=" color:#800080;">QByteArray</span>><span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">roleNames</span>()<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span>setRoleNameList(<span style=" color:#800080;">QVariantList</span><span style=" color:#c0c0c0;"> </span>roleNameList);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariantList</span><span style=" color:#c0c0c0;"> </span>roleNameList()<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">Q_INVOKABLE</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>rowCountSource()<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">Q_INVOKABLE</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span>append(<span style=" color:#800080;">QVariantMap</span><span style=" color:#c0c0c0;"> </span>variantMap);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">Q_INVOKABLE</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span>remove(<span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>i);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">Q_INVOKABLE</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span>setProperty(<span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>i,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>roleName,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariant</span><span style=" color:#c0c0c0;"> </span>data);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">Q_INVOKABLE</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span>setFilter(<span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>filterRole,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>filterText);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">Q_INVOKABLE</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span>clearFilter();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">signals</span>:</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span>roleNameListChanged(<span style=" color:#800080;">QVariantList</span><span style=" color:#c0c0c0;"> </span>roleNames);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">protected</span>:</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">bool</span><span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">filterAcceptsRow</span>(<span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>sourceRow,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span>&sourceParent)<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">private</span>:</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span><span style=" color:#c0c0c0;"> </span>*<span style=" color:#800000;">m_sourceModel</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariantList</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_roleNameList</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">};</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#000080;">#endif</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">//</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">FILTERMODEL_H</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br><!--EndFragment--></pre><div><br></div></div><div apple-content-edited="true"><br></div><div apple-content-edited="true"><pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">--------------------------------------------------------------------------------------------------------------------</span></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">filtermodel.cpp</span></pre><pre style="margin-top: 0px; margin-bottom: 0px;"><span style="color: rgb(0, 128, 0);">//</span><span style="color: rgb(192, 192, 192);"> </span><span style="color: rgb(0, 128, 0);">--------------------------------------------------------------------------------------------------------------------</span></pre><div><br></div></div><div apple-content-edited="true">
<pre style="margin-top: 0px; margin-bottom: 0px;"><!--StartFragment--><span style=" color:#000080;">#include</span><span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">"filtermodel.h"</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800080;">ListModelPrivate</span>::ListModelPrivate(<span style=" color:#800080;">QObject</span><span style=" color:#c0c0c0;"> </span>*parent)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>:<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QAbstractItemModel</span>(parent)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_dataList</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QList</span><<span style=" color:#800080;">QMap</span><<span style=" color:#800080;">QByteArray</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariant</span>><span style=" color:#c0c0c0;"> </span>>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800080;">ListModelPrivate</span>::~<span style="font-style: italic;">ListModelPrivate</span>()</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">delete</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_dataList</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span>::setRoleNameList(<span style=" color:#800080;">QVariantList</span><span style=" color:#c0c0c0;"> </span>roleNameList)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">for</span>(<span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>i<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>;<span style=" color:#c0c0c0;"> </span>i<span style=" color:#c0c0c0;"> </span><<span style=" color:#c0c0c0;"> </span>roleNameList.size();<span style=" color:#c0c0c0;"> </span>i++){</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariant</span><span style=" color:#c0c0c0;"> </span>variant<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>roleNameList.at(i);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>roleName<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>variant.toString();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_roleNames</span>.insert(i,roleName.toUtf8());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_roleNamesReverse</span>.insert(roleName.toUtf8(),<span style=" color:#c0c0c0;"> </span>i);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800080;">QHash</span><<span style=" color:#808000;">int</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QByteArray</span>><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span>::<span style="font-style: italic;">roleNames</span>()<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_roleNames</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span>::<span style="font-style: italic;">parent</span>(<span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span>&child)<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">Q_UNUSED</span>(child)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span>::<span style="font-style: italic;">index</span>(<span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>row,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>column,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span>&parent)<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">Q_UNUSED</span>(parent)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(row<span style=" color:#c0c0c0;"> </span><<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span><span style=" color:#c0c0c0;"> </span>||<span style=" color:#c0c0c0;"> </span>column<span style=" color:#c0c0c0;"> </span><<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span><span style=" color:#c0c0c0;"> </span>||<span style=" color:#c0c0c0;"> </span>row<span style=" color:#c0c0c0;"> </span>>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_dataList</span>->size()<span style=" color:#c0c0c0;"> </span>||<span style=" color:#c0c0c0;"> </span>column<span style=" color:#c0c0c0;"> </span>>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_roleNames</span>.size())</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span>createIndex(row,<span style=" color:#c0c0c0;"> </span>column,<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_dataList</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span>::<span style="font-style: italic;">rowCount</span>(<span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span>&parent)<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">Q_UNUSED</span>(parent)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_dataList</span>->size();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span>::<span style="font-style: italic;">columnCount</span>(<span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span>&parent)<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">Q_UNUSED</span>(parent)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_roleNames</span>.size();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span>::append(<span style=" color:#800080;">QVariantMap</span><span style=" color:#c0c0c0;"> </span>variantMap)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(variantMap.size()<span style=" color:#c0c0c0;"> </span>><span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>beginInsertRows(<span style=" color:#800080;">QModelIndex</span>(),<span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">rowCount</span>(),<span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">rowCount</span>());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QList</span><<span style=" color:#800080;">QByteArray</span>><span style=" color:#c0c0c0;"> </span>keys<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_roleNamesReverse</span>.keys();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QMap</span><<span style=" color:#800080;">QByteArray</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariant</span>><span style=" color:#c0c0c0;"> </span>map;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QByteArray</span><span style=" color:#c0c0c0;"> </span>key;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">foreach</span><span style=" color:#c0c0c0;"> </span>(key,<span style=" color:#c0c0c0;"> </span>keys)<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(variantMap.contains(key))</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>map.insert(key,<span style=" color:#c0c0c0;"> </span>variantMap.value(key));</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">else</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>map.insert(key,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariant</span>());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_dataList</span>->append(map);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>endInsertRows();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span>::remove(<span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>i)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(i<span style=" color:#c0c0c0;"> </span>>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span><span style=" color:#c0c0c0;"> </span>&&<span style=" color:#c0c0c0;"> </span>i<span style=" color:#c0c0c0;"> </span><<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_dataList</span>->count())</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>beginRemoveRows(<span style=" color:#800080;">QModelIndex</span>(),<span style=" color:#c0c0c0;"> </span>i,<span style=" color:#c0c0c0;"> </span>i);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_dataList</span>->removeAt(i);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>endRemoveRows();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800080;">QVariant</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span>::<span style="font-style: italic;">data</span>(<span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span>&index,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>role)<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariant</span><span style=" color:#c0c0c0;"> </span>value;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QByteArray</span><span style=" color:#c0c0c0;"> </span>roleName<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_roleNames</span>.value(role,<span style=" color:#c0c0c0;"> </span><span style=" color:#008000;">""</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(!roleName.isEmpty()<span style=" color:#c0c0c0;"> </span>&&<span style=" color:#c0c0c0;"> </span>index.isValid()<span style=" color:#c0c0c0;"> </span>&&<span style=" color:#c0c0c0;"> </span>index.row()<span style=" color:#c0c0c0;"> </span><<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_dataList</span>->size())</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QMap</span><<span style=" color:#800080;">QByteArray</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariant</span>><span style=" color:#c0c0c0;"> </span>map<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_dataList</span>->at(index.row());</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>value<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>map.value(roleName);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span>value;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span>::setProperty(<span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>i,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>roleName,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariant</span><span style=" color:#c0c0c0;"> </span>data)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(i<span style=" color:#c0c0c0;"> </span>>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span><span style=" color:#c0c0c0;"> </span>&&<span style=" color:#c0c0c0;"> </span>i<span style=" color:#c0c0c0;"> </span><<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_dataList</span>->count())</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>role<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>roleFromRoleName(roleName);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(role<span style=" color:#c0c0c0;"> </span>>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QMap</span><<span style=" color:#800080;">QByteArray</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariant</span>><span style=" color:#c0c0c0;"> </span>map<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_dataList</span>->at(i);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>map.insert(roleName.toUtf8(),<span style=" color:#c0c0c0;"> </span>data);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>(*<span style=" color:#800000;">m_dataList</span>)[i]<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>map;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span>index<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>createIndex(i,role);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">emit</span><span style=" color:#c0c0c0;"> </span>dataChanged(index,<span style=" color:#c0c0c0;"> </span>index);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span>::roleFromRoleName(<span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>roleName)<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_roleNamesReverse</span>.value(roleName.toUtf8(),<span style=" color:#c0c0c0;"> </span>-<span style=" color:#000080;">1</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800080;">FilterModel</span>::FilterModel(<span style=" color:#800080;">QObject</span><span style=" color:#c0c0c0;"> </span>*parent)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>:<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QSortFilterProxyModel</span>(parent)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_sourceModel</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">new</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">ListModelPrivate</span>(parent);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style="font-style: italic;">setSourceModel</span>(<span style=" color:#800000;">m_sourceModel</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800080;">FilterModel</span>::~<span style="font-style: italic;">FilterModel</span>()</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">delete</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_sourceModel</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800080;">QHash</span><<span style=" color:#808000;">int</span>,<span style=" color:#800080;">QByteArray</span>><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">FilterModel</span>::<span style="font-style: italic;">roleNames</span>()<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_sourceModel</span>-><span style="font-style: italic;">roleNames</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">FilterModel</span>::setRoleNameList(<span style=" color:#800080;">QVariantList</span><span style=" color:#c0c0c0;"> </span>roleNameList)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(<span style=" color:#800000;">m_roleNameList</span><span style=" color:#c0c0c0;"> </span>!=<span style=" color:#c0c0c0;"> </span>roleNameList)<span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_roleNameList</span><span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>roleNameList;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_sourceModel</span>->setRoleNameList(roleNameList);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">emit</span><span style=" color:#c0c0c0;"> </span>roleNameListChanged(roleNameList);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#800080;">QVariantList</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">FilterModel</span>::roleNameList()<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_roleNameList</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">FilterModel</span>::rowCountSource()<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_sourceModel</span>-><span style="font-style: italic;">rowCount</span>();</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">FilterModel</span>::append(<span style=" color:#800080;">QVariantMap</span><span style=" color:#c0c0c0;"> </span>variantMap)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_sourceModel</span>->append(variantMap);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">FilterModel</span>::remove(<span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>i)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_sourceModel</span>->remove(i);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">FilterModel</span>::setProperty(<span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>i,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>roleName,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QVariant</span><span style=" color:#c0c0c0;"> </span>data)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_sourceModel</span>->setProperty(i,<span style=" color:#c0c0c0;"> </span>roleName,<span style=" color:#c0c0c0;"> </span>data);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">bool</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">FilterModel</span>::<span style="font-style: italic;">filterAcceptsRow</span>(<span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>sourceRow,<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span>&sourceParent)<span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">const</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(filterRole()<span style=" color:#c0c0c0;"> </span>>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QModelIndex</span><span style=" color:#c0c0c0;"> </span>index<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span>sourceModel()-><span style="font-style: italic;">index</span>(sourceRow,<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>,<span style=" color:#c0c0c0;"> </span>sourceParent);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span>(sourceModel()-><span style="font-style: italic;">data</span>(index,<span style=" color:#c0c0c0;"> </span>filterRole()).toString().contains(filterRegExp()));</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">else</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">return</span><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">true</span>;</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">FilterModel</span>::setFilter(<span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>filterRole,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QString</span><span style=" color:#c0c0c0;"> </span>filterText)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">int</span><span style=" color:#c0c0c0;"> </span>role<span style=" color:#c0c0c0;"> </span>=<span style=" color:#c0c0c0;"> </span><span style=" color:#800000;">m_sourceModel</span>->roleFromRoleName(filterRole);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">if</span><span style=" color:#c0c0c0;"> </span>(role<span style=" color:#c0c0c0;"> </span>>=<span style=" color:#c0c0c0;"> </span><span style=" color:#000080;">0</span>)</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>setFilterRole(role);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QRegExp</span><span style=" color:#c0c0c0;"> </span>rx(filterText,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">Qt</span>::<span style=" color:#800080;">CaseSensitive</span>,<span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">QRegExp</span>::<span style=" color:#800080;">FixedString</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>setFilterRegExp(rx);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span><span style=" color:#808000;">else</span></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>setFilterRole(-<span style=" color:#000080;">1</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><br></pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#808000;">void</span><span style=" color:#c0c0c0;"> </span><span style=" color:#800080;">FilterModel</span>::clearFilter()</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">{</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;"><span style=" color:#c0c0c0;"> </span>setFilterRole(-<span style=" color:#000080;">1</span>);</pre>
<pre style="margin-top: 0px; margin-bottom: 0px;">}<!--EndFragment--></pre><div><br></div></div>
<br><div apple-content-edited="true">
<div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><font color="#929292"><font><br class="Apple-interchange-newline"></font></font></div><br></div>
</div>
<br><div><div>Am 16.03.2014 um 18:59 schrieb Andrey Kozhevnikov <<a href="mailto:coderusinbox@gmail.com">coderusinbox@gmail.com</a>>:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
<div text="#000000" bgcolor="#FFFFFF">
well, its not trivial with GridView. You might need to use model to
filteredmodel sorting manually, or implement model in C++ with
methods you need<br>
<br>
<div class="moz-cite-prefix">On 16.03.2014 22:56, Tomek wrote:<br>
</div>
<blockquote cite="mid:9203EDAB-313F-4F3D-B837-17DFB5DB7938@tdress.de" type="cite">
<meta http-equiv="Content-Type" content="text/html;
charset=ISO-8859-1">
<div>Andrey, makes sense.</div>
It is an model which is not related to the file system.
<div>Instead, it contains strings like caption and url and few
booleans such as isFavourite and isActive.</div>
<div>I would like to use the mentioned booleans, to filter out
elements is a SilicaGridView.<br>
<div><br>
</div>
<div>/Tomek</div>
</div>
<div apple-content-edited="true">
</div>
<br>
<div>
<div>Am 16.03.2014 um 10:03 schrieb Andrey Kozhevnikov <<a moz-do-not-send="true" href="mailto:coderusinbox@gmail.com">coderusinbox@gmail.com</a>>:</div>
<br class="Apple-interchange-newline">
<blockquote type="cite">
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
<div 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>
<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;"><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;"><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;"><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;"><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;"><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;"><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 styl="" e="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;"><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;"><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;"><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;"><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;"><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="">_______________________________________________
<a moz-do-not-send="true" href="http://sailfishos.org/">SailfishOS.org</a> Devel mailing list</pre>
</blockquote>
<br>
</div>
_______________________________________________<br>
<a moz-do-not-send="true" href="http://sailfishos.org/">SailfishOS.org</a>
Devel mailing list</blockquote>
</div>
<br>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
<a href="http://SailfishOS.org">SailfishOS.org</a> Devel mailing list</pre>
</blockquote>
<br>
</div>
_______________________________________________<br><a href="http://SailfishOS.org">SailfishOS.org</a> Devel mailing list</blockquote></div><br></body></html>