<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
Howdy,<br>
<br>
I'm having this little issue when returning only those items which
matches to data in SilicaListView taken from XmlListModel.<br>
<br>
At the moment I do not have my complete source code because I'm
working but here's an example:<br>
<br>
<font face="FreeMono">XmlListModel<br>
{<br>
id: xml_Database<br>
<br>
source: <a class="moz-txt-link-rfc2396E" href="http://www.database.com/xml">"http://www.database.com/xml"</a><br>
query: "/main"<br>
<br>
XmlRole { name: "title"; query: "title/string()" }<br>
XmlRole { name: "subtitle"; query: "description/string()" }<br>
}<br>
<br>
SilicaListView<br>
{<br>
id: list_Database<br>
<br>
width: parent.width<br>
height: parent.height<br>
<br>
PullDownMenu<br>
{<br>
SearchField<br>
{<br>
id: search_Database<br>
<br>
width: parent.width<br>
<br>
font.pixelSize: Theme.fontSizeTiny<br>
font.bold: false<br>
color: Theme.highlightColor<br>
placeHolderText: "Search"<br>
placeHolderColor: Theme.secondaryHighlightColor<br>
}<br>
}<br>
<br>
header: PageHeader<br>
{<br>
title: "Results"<br>
}<br>
<br>
model: xml_Database<br>
<br>
delegate: Item<br>
{<br>
width: ( parent.width - ( 2.0 * Theme.paddingLarge ))<br>
height: column_Database<br>
<br>
Column<br>
{<br>
id: column_Database<br>
<br>
spacing: Theme.paddingSmall<br>
<br>
Label<br>
{<br>
text: Theme.highlightText ( model.title, </font><font
face="FreeMono"><font face="FreeMono">search_Database</font>.text,
Theme.highlightColor )<br>
font.pixelSize: Theme.fontSizeSmall<br>
font.bold: false<br>
color: Theme.primaryColor<br>
}<br>
<br>
Label<br>
{<br>
text: model.subtitle<br>
font.pixelSize: Theme.fontSizeExtraSmall<br>
font.bold: false<br>
color: Theme.secondaryColor<br>
}<br>
}<br>
}<br>
<br>
ViewPlaceHolder<br>
{<br>
text: "No results"<br>
<br>
enabled: (( list_Database.count === 0.0 ) ? true : false )<br>
visible: (( list_Database.count === 0.0 ) ? true : false )<br>
}<br>
<br>
VerticalScrollDecorator<br>
{<br>
flickable: list_Database<br>
}<br>
}</font><br>
<br>
So this is just a small part of my code but basically this should
hold the problem.<br>
<br>
When I pull down the pulley menu I can access the SearchField
component. After that I write something in it and if it can find
exactly the same string from the results (and to be precise, from
'model.title') it returns that part in a 'Theme.highlightColor'
instead of 'Theme.primaryColor'.<br>
<br>
Okay, brilliant. But what if I want to only return those items that
actually match the entered search string? Let's say I get 50+
results in a SilicaListView element and I want that user is able to
filter the results with the SearchField component.<br>
<br>
How am I able to achieve this?<br>
<br>
Oh, and I don't know anything about C++ so I hope this can be done
either with QML or JavaScript - or both of them.<br>
<br>
Sincerely,<br>
Heikki Kullas<br>
<br>
P.S. The code might give some errors because I'm at work and I just
wrote it but it should demonstrate the idea and the issue I can not
solve by myself.<br>
</body>
</html>