Hi,
In my application QMLApplicationViewer is initialized with some properties in the main.cpp & then the relevant qml is activated.
Now i am passing the reference of the QMLApplicationViewer(from main.cpp) in some other class also which is derived from QDeclarativeView. Now my application needs to loads a particular view(QML) at some instance & for that i am calling a function from QML in this same class inside which the new QML is loaded using the same of instance of QMLApplicationViewer:
class soemclass: public QObject
{
Q_OBJECT
public:
explicit soemclass( QDeclarativeView *view,QObject *parent = 0); , this is called from main & takes the QMLApplicationViewer reference.
QDeclarativeView *main_view;
}
soemclass::soemclass(QDeclarativeView *view,QObject *parent) :
QObject(parent), main_view(view)
{
// this saves the instance of QMLApplicationViewer in main_view
}
void soemclass::LoadNewQml() // this is called from QML to load new QML
{
main_view->setSource(QUrl::fromLocalFile(Qmlname));
main_view->setcontext("somename", someinstance);
main_view->showFullScreen();
}
Now everytime my application needs to load a new QML, i am calling the above function.
Also i cannot call a particluar QML from other QML as my application needs to loads some data before the QML is loaded, so i am using the above approach.
So what i need to know is , would there be any problem if i use the above approach for loading the new QML's using the same instance of QMLApplicationViewer?

Reply With Quote

