Hi,
I have an xml like below
I am using XmlListModel to parse the XML and display the xml content in a delegate like belowCode:<channel> <item> <type> On </type> <title> item1 <</title> <imagePath> http://... </imagePath> </item> <item> <type> On </type> <title> item2 <</title> <imagePath> http://... </imagePath> </item> <item> <type> Off </type> <title> item3 <</title> <imagePath> http://... </imagePath> </item> <item> <type> Off </type> <title> item4 <</title> <imagePath> http://... </imagePath> </item> <item> <type> On </type> <title> item5 <</title> <imagePath> http://... </imagePath> </item> </channel>
With this above code I can perfectly display all the items in the listview. Now what I am trying to do is, I just want to display the items that are having On in there <type> tag.Code:XmlModel {id: feedModel} ListView { id: list width: mainwindow.width ; height: mainwindow.height model: feedModel delegate: NewsDelegate {} }
I put a check in the delegate file and can display item that are having On in there <type> tag, with the below code
But when I do this it displays the 1st, 2nd and the 5th items leaving the 3rd and 4th place blank (empty). I mean in the listview the 3rd and 4th place remains empty, and the 5th item doesn't comes after the 2nd item.Code:Image { id: thumb source: if(type == "On"){imagePath} // display only one category item x: 1; y: 1; smooth: true }
Any idea why this is happening or how can I resolve this. please suggest me




