12-25-2012 05:16 PM
hi ![]()
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())));
Q_ASSERT(success);
// QObject::connect(newButton, SIGNAL(cnlicked()),this,SLOT(ont(*newButton)));
app->setScene(root);
}
int classa:
nt( 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();
}