1
0
mirror of https://gitlab.com/kelteseth/ScreenPlay.git synced 2024-11-07 03:22:33 +01:00
ScreenPlay/Content/widget_rss_guardian_news/main.qml

77 lines
1.7 KiB
QML
Raw Normal View History

2023-07-29 11:01:56 +02:00
// SPDX-License-Identifier: BSD-3-Clause
import QtQuick
import QtQuick.Controls
import QtQuick.Controls.Material
import QtQuick.Effects
import QtQuick.Particles
import QtQml.XmlListModel
Item {
id: root
implicitWidth: 480
implicitHeight: 480
XmlListModel {
id: feedModel
2023-07-29 11:01:56 +02:00
source: "https://www.theguardian.com/world/rss"
query: "/rss/channel/item"
onStatusChanged: {
if (status === XmlListModel.Error) {
2023-07-29 11:01:56 +02:00
console.log("Error: " + errorString)
}
}
2023-06-11 10:07:39 +02:00
XmlListModelRole {
2023-07-29 11:01:56 +02:00
name: "title"
elementName: "title"
2023-06-11 10:07:39 +02:00
}
XmlListModelRole {
2023-07-29 11:01:56 +02:00
name: "link"
elementName: "link"
2023-06-11 10:07:39 +02:00
}
XmlListModelRole {
2023-07-29 11:01:56 +02:00
name: "description"
elementName: "description"
2023-06-11 10:07:39 +02:00
}
XmlListModelRole {
name: "category"
elementName: "category"
2023-07-29 11:01:56 +02:00
attributeName: "domain"
2023-06-11 10:07:39 +02:00
}
XmlListModelRole {
2023-07-29 11:01:56 +02:00
name: "pubDate"
elementName: "pubDate"
2023-06-11 10:07:39 +02:00
}
XmlListModelRole {
2023-07-29 11:01:56 +02:00
name: "guid"
elementName: "guid"
}
XmlListModelRole {
name: "creator"
elementName: "dc:creator"
}
XmlListModelRole {
name: "date"
elementName: "dc:date"
2023-06-11 10:07:39 +02:00
}
XmlListModelRole {
2023-07-29 11:01:56 +02:00
name: "mediaContent"
elementName: "media:content"
attributeName: "url"
2023-06-11 10:07:39 +02:00
}
}
ListView {
id: list
anchors.fill: parent
anchors.margins: 10
anchors.topMargin: 20
spacing: 10
model: feedModel
delegate: PostDelegate {
2023-07-29 11:01:56 +02:00
width: root.width
}
}
}