Parsing RSS Feeds by XmlListModel

It's true that we now have categories, but they don't seem to be involved with RSS at all. Also, if you dig deeper, you'll find that the RSS feeds are in fact the XML documents. Qt already provides a useful type to help us parse them. We don't need to reinvent the wheel. This powerful type is the so-called XmlListModel element and it uses XmlRole to query.

Firstly, we need to expose the url role of categoriesModel to the main scope. This is done by declaring the property storing the model's current element, url, inside ListView. Then, we can add an XmlListModel element and use that url element as its source. Accordingly, the modified main.qml file is pasted here:

import QtQuick 2.3 import QtQuick.Window 2.2 import ...

Get Qt 5 Blueprints now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.