Qt 4.8.2 QWebView在HTTP POST中缺少Content-type,默认为application / octet-stream

时间:2013-06-20 22:18:23

标签: c++ qt qwebview

我有从网页打开的弹出窗口(其paypal弹出窗口) 我捕获它然后我尝试修复此错误,因为文件建议http://qt-project.org/doc/note_revisions/84/125/view
但我仍然得到这个错误 这是我的QWebView类

class WebView : public QWebView
{
    Q_OBJECT
public:
    WebView()
    {
        connect( this->page()->networkAccessManager(),
             SIGNAL(sslErrors(QNetworkReply*, const QList<QSslError> & )),
             this,
             SLOT(sslErrorHandler(QNetworkReply*, const QList<QSslError> & )));
    }

private slots:
    void sslErrorHandler( QNetworkReply *reply, const QList<QSslError> &errors)
    {
        qDebug() << "sslErrorHandler:";
        foreach (QSslError err, errors)
          qDebug() << "ssl error: " << err;

        reply->ignoreSslErrors();
    }

protected:
    QWebView *createWindow(QWebPage::WebWindowType type)
    {
        QWebView *webview = new QWebView;

        QUrl tmpUrl = webview->url(); 
        QNetworkRequest request(tmpUrl);
        //request.setHeader(QNetworkRequest::ContentTypeHeader,QVariant("application/x-www-form-urlencoded"));
        request.setHeader(QNetworkRequest::ContentTypeHeader,"application/octet-stream");

        //webview->show();
        webview->load(request,QNetworkAccessManager::PostOperation);
        return webview;
    }
};

我在这里做错了什么?

0 个答案:

没有答案