Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import QtQuick 1.0
- Rectangle {
- signal checkNetworkStatus
- width: 360
- height: 360
- Component.onCompleted: {
- queryData(); //Comment or Uncomment this line for testing
- autoUpdateTimer.start();
- }
- function queryData(){
- var queryURL = 'http://www.google.com';
- var response = new XMLHttpRequest();
- response.onreadystatechange = function() {
- if (response.readyState == XMLHttpRequest.DONE) {
- console.log("Connection successful. Now disconnect from wifi for testing");
- }
- }
- response.open("GET", queryURL);
- response.send();
- }
- Timer {
- id: autoUpdateTimer
- interval: 20000
- repeat: true
- onTriggered: {
- checkNetworkStatus();
- }
- }
- Text {
- text: "Hello World"
- anchors.centerIn: parent
- }
- MouseArea {
- anchors.fill: parent
- onClicked: {
- Qt.quit();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement