Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Http connexion from secondary thread

Http connexion from secondary thread

Scheduled Pinned Locked Moved General and Desktop
4 Posts 2 Posters 678 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.
  • C Offline
    C Offline
    cristeab
    wrote on last edited by
    #1

    Hi

    I am trying to create a HTTP connexion from a secondary thread, while the object receiving the finished() signal is in the main thread. The idea here is to let the main thread do UI initialisations. In this case it seems that the finished() signal is no longer received, but no connect() error is seen. Could you help in solving this issue ?

    thanks
    Bogdan

    1 Reply Last reply
    0
    • Chris KawaC Online
      Chris KawaC Online
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Where do you connect the finished signal (in which thread) and in which thread the sending and receiving objects live? Is the connection type the proper one, i.e. Qt::QueuedConnection?

      Btw. the QNAM requests are asynchronous so there is usually no benefit in running them from another thread.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        cristeab
        wrote on last edited by
        #3

        The finished signal is connected in the worker thread, started with QtConcurrent::run(). The object that generates the finished signal is also created in the worker thread. The connection type is the default one: Qt::AutoConnection

        1 Reply Last reply
        0
        • Chris KawaC Online
          Chris KawaC Online
          Chris Kawa
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Ok then. Without some code I can only throw guesses - are you sure both the QNAM and the connected object are still alive when the signal is emitted? can you connect a lambda and see if it gets called?

          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