I have an issue with a list/detail pattern. I have an Article class, inheriting from QObject
, defining some properties (title
, updated
and content
being the ones that matters for now). To populate my (QML) ListView
, I have a C++ GroupDataModel
, filled with some Article*
. Here's my list's onTriggered
:
onTriggered: {
if (indexPath.length > 1) {
currentArticle = dataModel.data(indexPath);
var page = articlePageDefinition.createObject();
nav.push(page)
}
}
As you can guess, the articlePageDefinition
defines a page using the upper currentArticle
property.
Now, when I display the articlePage once, it's working fine. I can go back, click on the same list item, display the same Article
details, works great. But when I pick a second article, the app kind of freezes. I can go back in my navigation pane, but I can't click on list items anymore. I tried to add some logs, the onTriggered
is stuck on currentArticle = dataModel.data(indexPath);
. At this point, I can log every property of dataModel.data(indexPath)
without any issue. I tried to not create/push the page, simply affect currentArticle
and display some of its properties, it's working fine too. I really don't understand what I am doing wrong here, any help appreciated.
In case you need to see more code, everything is here: https://github.com/Kernald/tt-rss-bb10/tree/e29e3b616aa179dd42f66804ecc20a6a45b6bb22
currentArticle
property by anarticle
property in the detail page, it's working fine. You're right that it's the good way to do it, and I'll keep it this way. But I'm still curious about the reason of the original issue. – Marc Plano-Lesay