I make a program work different qml files, first show a screen for get idClient, click a button and make a post (it's works fine), second, the new screen get idVent, click a button and make a post(this works too), and finally a third screen show a lot of data. My problem is occasionally may be get a error in post method, and I will show a message of error(this disappears with button) and I give how argument the string saying error(how show the string not is problem, the problem is how pass the string).
I will have a loader element, and works fine if i don't include the error management. And i don't want instance in qml the C++ object (for example my class of Httppost). My qml Code is this:
Loader {
id: pageLoader // ID needed for so we can later delete the item
source: "AnimationSplash.qml"
focus: true
property bool valid: item !== null
anchors.horizontalCenter: parent.horizontalCenter
objectName: "switchPages"
}
Timer {
id: firstPhaseTimer
interval: 750
running: true
repeat: false
onTriggered:{
pageLoader.item.opacity=0;
pageLoader.source="SearchRecipient.qml"
}
}
Connections{
target:pageLoader.item
ignoreUnknownSignals: true
onPostIdClient: {
postClient(pageLoader.typeId, pageLoader.textIdClient)
}
onPostIdVent: {
postVent(pageLoader.textIdVent)
pageLoader.source="MainView.qml"
}
}
postIdClient and postIDVent are signals from load files, but anyone have a suggerence how change ErrorScreen, if my manage of error is in C++.
My C++ constructor code (is where I load a main.qml file) is this:
QObject *mainObject;
QQuickView view;
view.setSource(QUrl::fromLocalFile("./ui/main.qml"));
view.setResizeMode(QQuickView::SizeRootObjectToView);
view.show();
mainObject=view.rootObject();
QObject *switcher=mainObject->findChild<QObject*>("");
if(mainObject)
{
QObject::connect(mainObject, SIGNAL(postClient(QString,QString)), this, SLOT(postingClientData(QString,QString)),Qt::UniqueConnection);
QObject::connect(mainObject, SIGNAL(postVent(QString)), this, SLOT(postIdVent(QString)),Qt::UniqueConnection);
}
Finally, how read and set properties of MainView, if i don't have access from child QObject of QQuickView (i use this clase for load main.qml)