Sunday, April 28, 2024
3
rated 0 times [  3] [ 0]  / answers: 1 / hits: 823  / 1 Year ago, fri, april 7, 2023, 8:40:32

I'm working at app for ubuntu touch. I have a code with listView in it. But when I run it the page is simply empty (tehre is a title and a tabs switcher). Where is the mistake?



import QtQuick 2.0
import Ubuntu.Components 0.1
import Ubuntu.Components.ListItems 0.1 as ListItem
import QtQuick.XmlListModel 2.0

MainView {

applicationName: "El Wohust"
objectName: "elwohust"

width: units.gu(50)
height: units.gu(75)
XmlListModel {
id: portals
source: "http://localhost/feed.xml"
query: "/portals/item"

XmlRole { name: "title"; query: "title/string()" }
XmlRole { name: "pubDate"; query: "pubDate/string()" }
}

// Here

Tab {
title: i18n.tr("2nd list")
Page {
id: subreddits
anchors.fill: parent

ListView {
id: articleList


model: portals
delegate: ListItem.Subtitled {
text: title
subText: pubDate
progression: true
onClicked: pageStack.push(articleView)
}

}
}
}

}

}


Here is how the XML file looks like:



<?xml version="1.0" encoding="utf-8"?>
<portals>

<item>
<title>Karlův most</title>
<pubDate>Sat, 07 Sep 2010 10:00:01 GMT</pubDate>
</item>
<item>
<title>Sv. Vít</title>
<pubDate>Sat, 07 Sep 2010 15:35:01 GMT</pubDate>
</item>

</portals>

More From » application-development

 Answers
0

I think you need anchors.fill: parent on the ListView as well.


[#31647] Saturday, April 8, 2023, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
olfdit

Total Points: 118
Total Questions: 98
Total Answers: 97

Location: Honduras
Member since Fri, Nov 25, 2022
1 Year ago
;