Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Native Development


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.


Reply
Contributor
Posts: 13
Registered: ‎11-30-2012
My Device: Alpha
My Carrier: Pepephone

GroupDataModel c++ upgrading terminates app

Hello. I whant to upgrade the rows of a ListView, but app terminates. I have made this simple test

 

C++

BugTest::BugTest(bb::cascades::Application *app)
: QObject(app)
{
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").parent(this);

    // create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();
     GroupDataModel *model = new GroupDataModel(QStringList() << "country" << "continent");
    QVariantMap map;
    map["country"] = "Italy"; map["continent"] = "Europe"; model->insert(map);
    map["country"] = "Japan"; map["continent"] = "Asia"; model->insert(map);

    ListView *listView =root->findChild<ListView*>("list");
        if (listView){
            listView->setDataModel(model);
   }
    qml->setContextProperty("Main", this);
    app->setScene(root);
}
void BugTest::changePage(){
	QmlDocument *qml2 = QmlDocument::create("asset:///main.qml");
	AbstractPane *root2 = qml2->createRootObject<AbstractPane>();
    GroupDataModel *model = new GroupDataModel(QStringList() << "country" << "continent");
    QVariantMap map;
    map["country"] = "US"; map["continent"] = "America"; model->insert(map);
    map["country"] = "Mexico"; map["continent"] = "America"; model->insert(map);

    ListView *listView =root2->findChild<ListView*>("list");
        if (listView){
            listView->setDataModel(model);
   }
    qml2->setContextProperty("Main", this);
    Application::instance()->setScene(root2);

}

 qml:

 

import bb.cascades 1.0

Page {
    Container {
        Button {
            text: "Update list - Bug"
            objectName: "button2"
            onClicked: Main.changePage();
            
        }
        ListView {
            objectName: "list"
            id: lista
        }
    }
}

 

After the changePage method has finish, app terminates with message: 

Process 89993425 (bugTest) terminated SIGSEGV code=1 fltno=11 ip=7821bac0(/base/usr/lib/qt4/lib/libQtDeclarative.so.4.8.3@_ZNK22QDeclarativeExpression11scopeObjectEv+0x7) mapaddr=0011bac0. ref=00000028

 

Is this a bug?

Is there a way to get the current scene for getting the actual listView without reloading the full page?

 

regards