0

Currently I have this code here

}else if (currentUrl == "http://api.stackmob.com/issue" && post == "NO"){
                    setGroupDataModel(response, "desc");
                    QDeclarativePropertyMap* propertyMap = new QDeclarativePropertyMap;
                        propertyMap->insert("name", currentProjectNameSelected);
                        QmlDocument *qml = QmlDocument::create("asset:///projectissues.qml").parent(this);

                        qml->setContextProperty("cppObj", propertyMap);


                        //qml->setContextProperty("cppObj", this);

                        Page* root = qml->createRootObject<Page>();
                        pane->push(root);

Whenever I use the ("cppObj", this); It displays all the items from stackmob in a listview but the name of the label in the qml is not displayed. However, when I use the ("cppObj", propertyMap) it doesnt display the listview from stackmob but it displays the label of the qml. What should I do?

Michael Donohue
  • 11,776
  • 5
  • 31
  • 44
kev
  • 155
  • 1
  • 11

1 Answers1

0

Without having the QML, I can't be sure, but you need a way to access to both propertyMap and your instance from QML. Right now, you're trying to set both with "cppObj" name. Try to use some explicit names like "issueModel", "modelProperties", or whatever. If you use different name, you'll be able to access to both from your QML.

Marc Plano-Lesay
  • 6,808
  • 10
  • 44
  • 75