QWebView view(0);view.load(QUrl("http://google.com"));
webView->settings()->setAttribute(QWebSettings::AutoLoadImages, true);webView->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);QString Connection("keep-alive"); QString AcceptLanguage("ru,en-us;q=0.7,en;q=0.3"); QString ContentLength(""); QString AcceptEncoding("gzip,deflate"); QString Accept("text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8"); QString AcceptCharset("windows-1251,utf-8;q=0.7,*;q=0.7"); QString KeepAlive("300"); QString UserAgent("Mozilla/5.0 (X11; U; Linux x86_64; ru; rv:1.9.0.13) Gecko/2009080317 Fedora/3.0.13-1.fc10 Firefox/3.0.13");
headers = QHttpRequestHeader("POST", url, 1, 1); //1 headers.setValue("Connection", Connection); //2 headers.setValue("Accept-Language", AcceptLanguage); //3 headers.setContentLength( ba.length() );
QByteArray data = http->readAll(); webView->setHtml(data);
QByteArray data = http->readAll();webView->setHtml(data);
connect(http, SIGNAL(responseHeaderReceived ( const QHttpResponseHeader)),this, SLOT(responseHeaderReceived ( const QHttpResponseHeader)));
connect(http, SIGNAL(done(bool)),this, SLOT(httpRequestDone(bool)));
connect(http, SIGNAL(responseHeaderReceived(const QHttpResponseHeader&)), this, SLOT(responseHeaderReceived(const QHttpResponseHeader&)));