Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt WebKit
  4. Compare QUrl or slot for each response?
QtWS25 Last Chance

Compare QUrl or slot for each response?

Scheduled Pinned Locked Moved Unsolved Qt WebKit
c++11qnetworkaccessmrestful apisignals & slotsqurl
4 Posts 2 Posters 986 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.
  • R Offline
    R Offline
    Rizwan94
    wrote on 2 Dec 2019, 02:11 last edited by
    #1

    Hi All
    I am working on a Qt C++ application.
    I am making restAPI requests through my application using QNAM.

    Currently I am connecting to the replyFinished signal of the QNAM, once the response arrives I am comparing the url's to find out this response is for which request.

    Another approach would be to connect to the replyFinished of the QNetworkReply and define different slots for each response.

    Which is the best practice for handling such scenarios? When a lot of restAPI calls will be made.

    Let me know if you may need more info about my question.

    J 1 Reply Last reply 2 Dec 2019, 05:30
    0
    • R Rizwan94
      2 Dec 2019, 02:11

      Hi All
      I am working on a Qt C++ application.
      I am making restAPI requests through my application using QNAM.

      Currently I am connecting to the replyFinished signal of the QNAM, once the response arrives I am comparing the url's to find out this response is for which request.

      Another approach would be to connect to the replyFinished of the QNetworkReply and define different slots for each response.

      Which is the best practice for handling such scenarios? When a lot of restAPI calls will be made.

      Let me know if you may need more info about my question.

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 2 Dec 2019, 05:30 last edited by
      #2

      @Rizwan94 You could use lambda functions as slots and capture the request object.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1
      • R Offline
        R Offline
        Rizwan94
        wrote on 2 Dec 2019, 05:44 last edited by
        #3

        Hi Thanks for the reply.
        So, you mean to say

        1. Connecting to replyFinished of QNetworkReply is better than replyFinished of QNAM
        2. Rather than defining multiple slots, handle using lambda funtions.

        Did I get you right?

        J 1 Reply Last reply 2 Dec 2019, 05:46
        0
        • R Rizwan94
          2 Dec 2019, 05:44

          Hi Thanks for the reply.
          So, you mean to say

          1. Connecting to replyFinished of QNetworkReply is better than replyFinished of QNAM
          2. Rather than defining multiple slots, handle using lambda funtions.

          Did I get you right?

          J Offline
          J Offline
          jsulm
          Lifetime Qt Champion
          wrote on 2 Dec 2019, 05:46 last edited by
          #4

          @Rizwan94

          1. I never used QNAM, so do not know whether better to use that one or QNetworkReply
          2. Yes

          https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          4/4

          2 Dec 2019, 05:46

          • Login

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