Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QNetworkAccessManager
Forum Updated to NodeBB v4.3 + New Features

QNetworkAccessManager

Scheduled Pinned Locked Moved QML and Qt Quick
1 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Mr.FreakyJo
    wrote on last edited by
    #1

    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( "http://somesite.com"));

    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() ),
    SLOT(homepagesc()));@

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved