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. Auto can I check the result of a connect() with Qt::AutoConnection
Forum Updated to NodeBB v4.3 + New Features

Auto can I check the result of a connect() with Qt::AutoConnection

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 3 Posters 709 Views 2 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.
  • J Offline
    J Offline
    JulienMaille
    wrote on last edited by
    #1

    I'm having some weird difference between the same program compiled in Qt 4.8 and Qt 5.15
    and I suspect that Qt::AutoConnection doesn't behave the same in both case.
    Is there a way I can check if the connection resulted in Qt::DirectConnection or Qt::QueuedConnection?
    Thanks!

    JKSHJ 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Unless you force the type, it will be selected at run time. The objects being in different threads is the key for a queued connection.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • J Offline
        J Offline
        JulienMaille
        wrote on last edited by
        #3

        Can this be checked at runtinme? connect() returns a handle, but it doesn't contains this kind of information.

        1 Reply Last reply
        0
        • J JulienMaille

          I'm having some weird difference between the same program compiled in Qt 4.8 and Qt 5.15
          and I suspect that Qt::AutoConnection doesn't behave the same in both case.
          Is there a way I can check if the connection resulted in Qt::DirectConnection or Qt::QueuedConnection?
          Thanks!

          JKSHJ Offline
          JKSHJ Offline
          JKSH
          Moderators
          wrote on last edited by
          #4

          @JulienMaille said in Auto can I check the result of a connect() with Qt::AutoConnection:

          I'm having some weird difference between the same program compiled in Qt 4.8 and Qt 5.15
          and I suspect that Qt::AutoConnection doesn't behave the same in both case.

          What weird difference are you seeing?

          The behaviour of Qt::AutoConnection has not changed between Qt 4 and Qt 5.

          Is there a way I can check if the connection resulted in Qt::DirectConnection or Qt::QueuedConnection?

          Check QObject::thread() for both the sender and receiver. If both use the same thread, then the connection is Qt::DirectConnection. If they use different threads, then the connection is Qt::QueuedConnection. This is what @SGaist meant.

          You can also call call QThread::currentThread() in the slot to see which thread ran the slot.

          Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

          1 Reply Last reply
          3
          • J Offline
            J Offline
            JulienMaille
            wrote on last edited by
            #5

            Thanks to both of you. I believe my issue has to do with processEvent() and not the connect. I will open another topic

            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