Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Connecting to a web service using Qt5.0.1
QtWS25 Last Chance

Connecting to a web service using Qt5.0.1

Scheduled Pinned Locked Moved Installation and Deployment
2 Posts 2 Posters 2.4k Views
  • 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.
  • O Offline
    O Offline
    oneboy99
    wrote on last edited by
    #1

    Hello,

    I am working with microsoft visual studio 2010, c++ project with Qt5.0.1.

    I try to connect to remote web service, but I cant find the right connect(..) function to use.

    here is my code:

    QNetworkAccessManager* m_pNetworkManager = new QNetworkAccessManager();
    QString qstrWSPathData = QString::fromWCharArray((LPCTSTR)WSPathData, WSPathData.GetLength());

    QUrl url(qstrWSPathData);
    QNetworkRequest request;
    request.setUrl(url);

    QNetworkReply* currentReply = m_pNetworkManager->get(request);

    connect(m_pNetworkManager ,
    SIGNAL ( finished(QNetworkReply*) ),
    this,
    SLOT ( onResult(QNetworkReply*)) );

    I took the connect(..) function from an example over the internet, and i can't compile it right..
    Can someone tell me what connect(..) method should I use and what is the header file it exist??

    Thank you very much!

    Amit

    1 Reply Last reply
    0
    • J Offline
      J Offline
      Jake007
      wrote on last edited by
      #2

      Hi!

      For better readability please wrap your code in "@" tags.
      In order to compile Qt with networking, you need to add this to your project file:
      @QT += network@

      Qt network headers:
      @#include <QNetworkAccessManager>
      #include <QNetworkReply>@

      Your connect function looks correct.

      If it still doesn't works, post error you're getting.

      Regards,
      Jake


      Code is poetry

      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