Why Does Xmlhttprequest Responsetext Not Exist?
Solution 1:
In Windows 10 x86_64 with Qt Creator 4.11.0, this function in OP's main.qml
does nothing at all:
functionlogResults(results) {
console.log("RESULTS: " + results)
}
But it works perfectly on Linux. The problem is only in Windows. Nothing is printed in the output panel. No errors, no "qml: something". Nada. As a workaround, this alternative works:
functionlogResults(results) {
console.log("RESULTS Length=", results.length);
console.log("results.substr=", results.substr(0, 20));
}
It prints something at the "Application output" panel:
qml: RESULTS Length= 47932
qml: results.substr= <!doctype html><html
Digging a bit further, we can observe that this:
console.log("results.substr=", results.substr(0, 32000));
Works, but this fails again:
console.log("results.substr=", results.substr(0, 32800));
This suggest that there is a limit about 32K, and console.log() fails silently when the content is larger than this limit. But only in Windows. This smells like a bug somewhere in Qt...
Edit
It is not only a problem with console.log()
, but in QtCreator's logging. This program fails to print all the output in the Application Output panel:
#include<QCoreApplication>#include<QDebug>intmain(int argc, char *argv[]){
QCoreApplication a(argc, argv);
QString str;
str.fill('1', 32763);
qDebug() << str;
str.fill('2', 32764);
qDebug() << str;
return0;
}
The '2's string is correctly displayed only when selecting Project > Run Settings > Run in terminal checkbox, but it is omitted when the checkbox is clear. Any message larger than 32763 characters is silenced in Application Output.
Bug report created: https://bugreports.qt.io/browse/QTCREATORBUG-23454
Post a Comment for "Why Does Xmlhttprequest Responsetext Not Exist?"