简体   繁体   English

Qt,在QNetworkRequest中捕获表单值

[英]Qt, catch form values in QNetworkRequest

I have a QWebView component in my Qt widget application. 我的Qt小部件应用程序中有一个QWebView组件。 And I have already created a network manager to handle requests from the QWebView . 而且我已经创建了一个网络管理器来处理来自QWebView的请求。

What I want to do is catching the values of the web form inside QWebView , up to this point of time I have the QNetworkRequest instance of every network request. 我要做的是在QWebView捕获 Web表单的值, 直到现在 ,我已经拥有每个网络请求的QNetworkRequest实例。

How to extract the form values from the QNetworkRequest instance ? 如何从QNetworkRequest实例提取表单值

You can use this function of QNetworkRequest class: 您可以使用QNetworkRequest类的此功能:

QByteArray QNetworkRequest::rawHeader ( const QByteArray & headerName ) const

which returns the raw form of header named headerName . 它返回名为headerName的标头的原始形式。

Are you talking about the values on the get method? 您是否在谈论get方法的值?

    int i= 0;
    QPair<QString , QString > values;
    while( i < ui->webView->url().queryItems().count() )
    {
        values =  ui->webView->url().queryItems().at( i );
        i++;
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM