QML Ask user to connect to the internet if not connected?
-
I've got an app which connects to the internet to download stuff, but if there's no internet connection it just sits there not doing anything.
How can I check for internet connection and then ask to user to connect if they are not connected?
-
Check "QNetworkAccessManager::networkAccessible()":http://developer.qt.nokia.com/doc/qt-4.8/qnetworkaccessmanager.html#networkAccessible-prop
-
I was hoping there was a way to do it without any C++, this app that I am working on is purley QML so far and if possible I'd like to keep it that way.
-
There seems to be one other possible path, but I have never used it, so I can't help much. Take a look at "QDeclarativeEngine::networkAccessManager()":http://developer.qt.nokia.com/doc/qt-4.8/qdeclarativeengine.html#networkAccessManager but it still does require C++, as it would seem.
Or, you can use web kit or JS to access network. Or try to instantiate a QML component by URL, and display a message if that fails. But most probably, C++ will give you the most control over what is happening and when.