Hello Wysota
thanks again for your reply, but my QML contains that, let me rephrase the problem again:
1. following is my main.cpp where at first i am making an get request:
int main(int argc, char *argv[])
{
NetworkRequest httpRequest;
httpRequest.GetNewsResponse("http://iphone.blick.ch/");
QmlApplicationViewer viewer;
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
viewer.showExpanded();
return app.exec();
}
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
NetworkRequest httpRequest;
httpRequest.GetNewsResponse("http://iphone.blick.ch/");
QmlApplicationViewer viewer;
viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockPortrait);
viewer.setMainQmlFile(QLatin1String("qml/HybridApp/main.qml"));
viewer.showExpanded();
return app.exec();
}
To copy to clipboard, switch view to plain text mode
Here main.qml contains a wait indicator and is waiting for the data from the server.
2. Where NetworkRequest is a class derived from QObject and it simply helps in making an http get request from the method GetNewResponse.
3. in NetworkRequest Class i have connect the finished(QNetworkReply*) signal of QNetworkAccessManager with my GotNetWorkReply(QNetworkReply*) slot of that class. Everything works fine here.
4. Now when i get the reply from the network i write the following code:
QFile file("qml/HybridApp/HomeScreen.qml");
if(file.exists())
{
qDebug()<< "file exists";
QDeclarativeView homeScreenView;
homeScreenView.
setSource(QUrl::fromLocalFile("qml/HybridApp/HomeScreen.qml"));
homeScreenView.showFullScreen();
}
else
{
qDebug()<<"hell file doesnt exists";
}
QFile file("qml/HybridApp/HomeScreen.qml");
if(file.exists())
{
qDebug()<< "file exists";
QDeclarativeView homeScreenView;
homeScreenView.setSource(QUrl::fromLocalFile("qml/HybridApp/HomeScreen.qml"));
homeScreenView.showFullScreen();
}
else
{
qDebug()<<"hell file doesnt exists";
}
To copy to clipboard, switch view to plain text mode
5. Here HomeScreen.qml contains :
import QtQuick 1.0
Rectangle {
width: 360
height: 640
color: "red"
}
import QtQuick 1.0
Rectangle {
width: 360
height: 640
color: "red"
}
To copy to clipboard, switch view to plain text mode
5. Now what i want is when i get the ansynchronous reply from the webserver i want to show this QML file, using some possible options, i am trying that using QDeclarativeView::Show(), but its not working the QML file doesnt comes up.
Hope you now got my problem???
Waiting for your reply.
Bookmarks