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

Reply
Developer
nareshkodumuri
Posts: 125
Registered: ‎04-28-2012
My Device: BlackBerry 9800

Unable to set the dynamic properties to the qml file...?

Hi,

 

 

          I am facing the problem with ControlDelegate.The below is my Problem.

   main.qml

-----------------

import bb.cascades 1.0

Page {
    Container {
        layout: StackLayout {
            orientation: LayoutOrientation.TopToBottom
        }
       Button{
           objectName: "test"
           onClicked: {
               delegate.delegateActive=true;
           }
       }
       ControlDelegate {
           id:delegate
           delegateActive: false
           source: "asset:///Second.qml"
           onDelegateActiveChanged: {
               app.onButtonClicked();
           }
       }
    }
}

 Second.qml

------------------

import bb.cascades 1.0

Container {
    property alias labelText: changeProperty.text
    Label {
        id: changeProperty
        text: "text"
    }
}

 

Test.cpp

------------

#include <bb/cascades/Application>
#include <bb/cascades/QmlDocument>
#include <bb/cascades/AbstractPane>
#include <bb/cascades/Container>
#include <bb/cascades/Button>

using namespace bb::cascades;
Container *cont_root;
Test::Test(bb::cascades::Application *app)
: QObject(app)
{
    QmlDocument *qml = QmlDocument::create("asset:///main.qml").property("app",this);
    QmlDocument *qml_two = QmlDocument::create("asset:///Second.qml").parent(this);


    // create root object for the UI
    AbstractPane *root = qml->createRootObject<AbstractPane>();
    cont_root = qml_two->createRootObject<Container>();

    app->setScene(root);
}

void Test::onButtonClicked()
{
	qDebug()<<"************** button clicked***************";
	cont_root->setProperty("labelText","Text Changed");
}

 I have used  Second.qml file in main.qml file within the ControlDelegate.And when the button is clicked i am calling a method onButtonClicked() .Here i am changing the text property of the Second.qml file but it is not updating the second.qml file.Please solve this problem.Because of this problem i am unable to proceed further.

It's very urgent for me.

 

Thanks.

Please use plain text.
Developer
nareshkodumuri
Posts: 125
Registered: ‎04-28-2012
My Device: BlackBerry 9800

Re: Unable to set the dynamic properties to the qml file...?

[ Edited ]

Any help...!

Please solve this problem.

 

Thanks. 

Please use plain text.