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. Signals and slots without a slot
Forum Updated to NodeBB v4.3 + New Features

Signals and slots without a slot

Scheduled Pinned Locked Moved Solved QML and Qt Quick
3 Posts 2 Posters 287 Views 3 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.
  • A Offline
    A Offline
    Anita
    wrote on last edited by Anita
    #1

    Hi,
    @J-Hilk , @jsulm , @dheerendra

    I had a query regarding signals and slots.
    If a signal is emitted from C++ but there is no slot defined to receive the signal in qml, what happens to the signal emitted, will it still go through the main thread, and when there is no slot to receive it, what happens to the signal that is emitted?

    JKSHJ 1 Reply Last reply
    0
    • A Anita

      Hi,
      @J-Hilk , @jsulm , @dheerendra

      I had a query regarding signals and slots.
      If a signal is emitted from C++ but there is no slot defined to receive the signal in qml, what happens to the signal emitted, will it still go through the main thread, and when there is no slot to receive it, what happens to the signal that is emitted?

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

      @Anita said in Signals and slots without a slot:

      what happens to the signal emitted, will it still go through the main thread

      Signals do not "go through" any threads.

      When a signal is emitted, Qt checks to see if any slots are connected. If there is >=1 slot connected, Qt will run those slots.

      • If the connection type is Qt::AutoConnection or Qt::QueuedConnection (Recommended), then the slot will run in the slot's thread.
      • If the connection type is Qt::DirectConnection (NOT recommended), then the slot will run in the thread that emitted the signal.

      and when there is no slot to receive it, what happens to the signal that is emitted?

      Nothing special happens.

      As I described above, the signal emission just causes Qt to check for slots. If there are no slots connected, then the slot-check finishes very quickly.

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

      1 Reply Last reply
      7
      • A Offline
        A Offline
        Anita
        wrote on last edited by
        #3

        @JKSH

        Thank you for the response.

        1 Reply Last reply
        1

        • Login

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