yeikos
16th July 2014, 10:53
I don't know why but when the first request is executed the GUI freezes (W7x64, QT5.3, MinGW)
I tried disable the proxy config but without results.
10519
#include "mainwindow.h"
MainWindow::MainWindow() {
this->setUrl(QUrl("qrc:/index.html"));
this->setMaximumSize(QSize(200, 200));
// No proxy
QNetworkProxyFactory::setUseSystemConfiguration(fa lse);
this->page()->networkAccessManager()->setProxy(QNetworkProxy::NoProxy);
// Debug
this->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
QWebInspector *inspector = new QWebInspector();
inspector->setPage(this->page());
inspector->setVisible(true);
}
<html>
<body>
<div id="counter"></div>
<button id="request">request</button>
<script>
var counter = document.getElementById('counter'),
index = 0;
setInterval(function() {
counter.innerText = index++;
}, 100);
document.getElementById('request').onclick = function() {
var r = new XMLHttpRequest();
r.open('get', 'http://google.com');
r.send();
};
</script>
</body>
</html>
I tried disable the proxy config but without results.
10519
#include "mainwindow.h"
MainWindow::MainWindow() {
this->setUrl(QUrl("qrc:/index.html"));
this->setMaximumSize(QSize(200, 200));
// No proxy
QNetworkProxyFactory::setUseSystemConfiguration(fa lse);
this->page()->networkAccessManager()->setProxy(QNetworkProxy::NoProxy);
// Debug
this->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
QWebInspector *inspector = new QWebInspector();
inspector->setPage(this->page());
inspector->setVisible(true);
}
<html>
<body>
<div id="counter"></div>
<button id="request">request</button>
<script>
var counter = document.getElementById('counter'),
index = 0;
setInterval(function() {
counter.innerText = index++;
}, 100);
document.getElementById('request').onclick = function() {
var r = new XMLHttpRequest();
r.open('get', 'http://google.com');
r.send();
};
</script>
</body>
</html>