kromain / qml-utils Goto Github PK
View Code? Open in Web Editor NEWA collection of QML utilities and snippets
License: MIT License
A collection of QML utilities and snippets
License: MIT License
Just by changing qml load method.
engine.load(QUrl(QStringLiteral("qrc:/JSONListModel/Example.qml")));
model result get null
Any suggestion ?
Hello,
I have this code :
Page {
title: i18n.tr("Index")
ListView {
id: redditList
JSONListModel {
id: redditFeed
source: "http://www.reddit.com/r/Ubuntufr/hot.json"
query: "$.data.children[*]"
}
model: redditFeed.model
delegate: ListItem.Subtitled {
iconSource: model.data.thumbnail
Text {
horizontalAlignment: Text.AlignLeft
font.pixelSize: 12
color: "black"
text: model.data.title
}
}
}
}
but only the frist result is display ! Can you explain me why ?
Hi
I'm trying to map this model:
ListModel {
id: nestedModel
ListElement {
category: "Nintendo"
collapsed: true
// A ListElement can't contain child elements, but it can contain
// a list of elements. A list of ListElements can be used as a model
// just like any other model type.
subItems: [
ListElement { name: "Nintendo"; icon:"nes_library.png" },
ListElement { name: "Super Famicom"; icon: "snes_eujap_library.png" },
ListElement { name: "Super Nintendo"; icon: "snes_usa_library.png" }
]
}
ListElement {
category: "Sega"
collapsed: true
subItems: [
ListElement { name: "Sega Megadrive"; icon:"genesis_library.png" }
]
}
ListElement {
category: "Games"
collapsed: true
subItems: [
]
}
}
To JSON with limited success
The QML model works perfect with my current treeview implementation, I mapped it like this:
{
"root":[
{
"category":"Nintendo",
"collapsed":"true",
"subItems":[
{
"name":"Nintendo",
"icon":"nes_library.png"
},
{
"name":"Nintendo",
"icon":"nes_library.png"
},
{
"name":"Nintendo",
"icon":"nes_library.png"
}
]
},
{
"category":"Sega",
"collapsed":"true",
"subItems":[
{
"name":"Nintendo",
"icon":"nes_library.png"
},
{
"name":"Nintendo",
"icon":"nes_library.png"
},
{
"name":"Nintendo",
"icon":"nes_library.png"
}
]
}
]
}
But I only get the first level items for some reason
Your model have different api with XmlListModel. To be more simmilar "model: jsonModel1.model" must be replaced by "model: jsonModel1", remove 'model' variable from delegated item and add roles for paths.
not works:
JSONListModel {
json:'{"response":[5,467,2943,4424,13033]}'
query: '$.response[*]'
}
with error: QML ListModel: append: value is not an object
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.