Changing the XQuery from
q.setQuery("declare variable $file external;doc($file)//root");
to
q.setQuery("declare variable $file external;doc($file)//root/string()");
solved the problem.
The docs did actually state "The query must evaluate to a sequence of xs:string values. If the query does not evaluate to a sequence of strings, the values can often be converted by adding a call to string() at the end of the XQuery."
http://qt-project.org/doc/qt-4.8/qxmlquery.html#evaluateTo-3