Thank you for visiting the BlackBerry Support Community Forums.
BlackBerry will be closing the BlackBerry Support Community Forums Device Forums on April 1st (Developers, see below)
BlackBerry remains committed to providing excellent customer support to our customers. We are delighted to direct you to the CrackBerry Forums, a well-established and thorough support channel, for continued BlackBerry support. Please visit http://forums.crackberry.com or http://crackberry.com/ask. You can also continue to visit BlackBerry Support or the BlackBerry Knowledge Base for official support options available for your BlackBerry Smartphone.
"When we launched CrackBerry.com 10 years ago, we set out to make it a fun and useful destination where BlackBerry Smartphone owners could share their excitement and learn to unleash the full potential of their BlackBerry. A decade later, the CrackBerry community is as active and passionate as ever and I know our knowledgeable members and volunteers will be excited to welcome and assist more BlackBerry owners with their questions."
- Kevin Michaluk, Founder, CrackBerry.com
Developers, for more information about the BlackBerry Developer Community please review Join the Conversation on the BlackBerry Developer Community Forums found on Inside BlackBerry.
07-19-2013 03:45 AM - last edited on 07-19-2013 03:56 AM by Steve_T
I have a Xml file contacts.xml ,that content is below...
In cpp I just do below code
GroupDataModel *model = new GroupDataModel();
QVariant list = xda.load(
QDir::currentPath() + "/app/native/assets/contacts.xml",
key << "id";
When that XML have more then one chilled then data show in listview but when one chilled the data does not show.
Please help me......
Solved! Go to Solution.
07-19-2013 06:54 AM - edited 07-19-2013 06:56 AM
I'm not 100% sure, but I think if there's only 1 element it may be treating it as a map. So, something like this may be needed (untested):
QVariant list = xda.load( QDir::currentPath() + "/app/native/assets/contacts.xml", "/contacts/contact"); QVariantList l = list.value<QVariantList>(); if (l.isNull()) model->insert(list.value<QVariantMap>()); else model->insertList(list.value<QVariantList>());
Please tell if it works. If so, the docs should be updated to include this case.
07-22-2013 04:30 PM - edited 07-23-2013 01:14 PM
Please report this issue in jira (Developer Issue Tracker).
I confirm that Zmey's solution works. I have tried it myself and it does indeed provide a workaround to this bug. Just use isEmpty() instead of isNull(), which is not recognized as a valid QVariantList function.
QVariant list = xda.load( QDir::currentPath() + "/app/native/assets/contacts.xml", "/contacts/contact"); QVariantList l = list.value<QVariantList>(); if (l.isEmpty()) model->insert(list.value<QVariantMap>()); else model->insertList(list.value<QVariantList>());
07-23-2013 01:15 PM