I saw what the problem was. I had the function call in a switch statement in qml.
switch(returnint){
case 1:
loadingtext.text = "Already Connected"
break;
case 0: //do scan of networks in range
console.debug("Test")
var anArray = wifi.scan()
for (var i=0; i<anArray.length; i++)
console.log("Array item:", anArray[i])
console.debug("Test2")
break;
case -1:
loadingtext.text = "No wireless card found"
break;
}
I just had to put the case statements in brackets, or else only the first line would execute
case 0: //do scan of networks in range
{
console.debug("Test")
var anArray = wifi.scan()
for (var i=0; i<anArray.length; i++)
console.log("Array item:", anArray[i])
console.debug("Test2")
}
break;
From another thread on the qt project forum I see this is an issue in Qt4.8 but it has been fixed in Qt5, but since Im using Qt4.8 the brackets will do http://qt-project.org/forums/viewthread/9897