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

New Contributor
Posts: 6
Registered: ‎10-12-2012
My Device: bb10-dev
My Carrier: Initial developer


hi Smiley Happy


i have 2 class (main.cpp ;classa.hpp ,classa.cpp ;classb.hpp,classb.cpp) , and 2 qml page(a.qml;b.qml).


in classa.cpp the page a.qml is created and displayed , the a.qml contain a button "bb1"


the problem is: when i click in "bb1" how can i load,create and display (classb.cpp,classb.hpp,b.qml) 


this the code of *******************************************classa.cpp*******************************


classa::classa bb::cascades::Application *app)
: QObject(app)

QmlDocument *qml = QmlDocument::create("asset:///a.qml").parent(this);

AbstractPane *root = qml->createRootObject<AbstractPane>();

Button *newButtons = root->findChild<Button*>("bb1");

if (newButtons)
newButtons->setProperty("text", "button controlled");
bool success = Button::connect(newButtons, SIGNAL( clicked()), this,SLOT(ont(app->argc(),app->argv())));
// QObject::connect(newButton, SIGNAL(cnlicked()),this,SLOT(ont(*newButton)));



int classa:Smiley Surprisednt( int argc, char **argv)

Application app1(argc,argv);

// localization support
QTranslator translator;
QString locale_string = QLocale().name();
QString filename = QString( "classb_%1" ).arg( locale_string );
if (translator.load(filename, "app/native/qm")) {
app1.installTranslator( &translator );

new classb(&app1);

// we complete the transaction started in the app constructor and start the client event loop here
return Application::exec();