Passing QVariant from C++ function return to QML, Qt4.8

I have a function in C++ which is called from my QML code. When the function is void or returns an Int everything is fine. However when returning a QVariant and I call the function the function does not exceute

I get no error message of any sort. I have also tried to assign the return value to a "property variant" and just run it on its own (wifi.scan()) without assigning the return value to anything. Any ideas on what could be the problem?

I just had to put the case statements in brakets, or else only the first line would excecute
@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;@