Important: Please read the Qt Code of Conduct -


  • I've read that in QML the aplication creates as many objects of type QNetworkAccessManager it needs. So I have a few questions :
    1.Are the cookies share through all the instances of QNetworkAccessManager ?I want to login on a website ...
    2.How can XMLHttpRequest be used for sending POST/GET request?In Qt I created a QNetworkRequest and then used the manager to send it.Something like this :
    @QNetworkRequest request;
    //setam url-ul cererii
    request.setUrl(QUrl( ""));

    request.setRawHeader( "User-Agent", this->loginGUI->lineEditUserAgent->text().toLatin1() );

    request.setHeader( QNetworkRequest::ContentTypeHeader,"application/x-www-form-urlencoded" );

    QUrl params;

    params.addEncodedQueryItem( "user", QUrl::toPercentEncoding(this->loginGUI->lineEditName->text()));
    params.addEncodedQueryItem( "password", QUrl::toPercentEncoding(this->loginGUI->lineEditPassword->text() ) );
    params.addEncodedQueryItem( "clear", QUrl::toPercentEncoding( "true" ) );
    QByteArray paramBytes = params.toString().mid( 1 ).toLatin1();
    paramBytes.replace( "/", "/" );

    QNetworkReply *reply=nam->post(request,paramBytes);
    connect( reply, SIGNAL( finished() ),

Log in to reply