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. What is the differnce between Signal and slot?
Forum Updated to NodeBB v4.3 + New Features

What is the differnce between Signal and slot?

Scheduled Pinned Locked Moved General and Desktop
7 Posts 4 Posters 1.6k 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.
  • S Offline
    S Offline
    Sunmuk
    wrote on last edited by
    #1

    Hi all,
    I have a doubt about signal and slot.Whether the signal has definition or declaration only.and what is slot?.Please suggest me soon.

    Thanks

    M 1 Reply Last reply
    0
    • S Sunmuk

      Hi all,
      I have a doubt about signal and slot.Whether the signal has definition or declaration only.and what is slot?.Please suggest me soon.

      Thanks

      M Offline
      M Offline
      mcosta
      wrote on last edited by
      #2

      @Sunmuk said:

      Please suggest me soon.

      I suggest to read soon this page :)

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      1 Reply Last reply
      0
      • S Offline
        S Offline
        Sunmuk
        wrote on last edited by
        #3

        Hi,
        I referred the link mentioned previously.I am clear now with the concept like "Whether signal has implementation?".But still now confused with the signal.
        code snippet is
        signals:
        void ItemAdded( Item item);

        My question is
        1.How this signal is emitted?
        2.Why signal has the argument?
        3.What is the relation between signal and its parameter?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on last edited by
          #4

          Hi,

          1. how explained in the article, a signal is emitted using the emit keyword or the Q_EMIT macro
          emit <signal_name>(<parameters_list>);
          
          Q_EMIT <signal_name>(<parameters_list>);
          
          1. Sometimes you need to signal what is changed and not only that something is changed

          2. the signal is the notification that something happened, parameters are details about the event

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          S 1 Reply Last reply
          0
          • S Offline
            S Offline
            s.frings74
            wrote on last edited by
            #5

            Signals are declaration only. Slots provide the code that shall be executed when the signal gets emitted.

            When you emit a signal, then all assigned slots are executed with the arguments of the signal.

            1 Reply Last reply
            0
            • A Offline
              A Offline
              alex_malyu
              wrote on last edited by alex_malyu
              #6

              @s.frings74 said:

              Signals are declaration only.

              Even though other part of explanation is correct above is wrong.
              There is no magic and signal is actually a function.
              User does not provide its implementation though.
              It is automatically generated during mocing.
              You can check look at generated code in the generated moc_*.cpp file.

              1 Reply Last reply
              0
              • M mcosta

                Hi,

                1. how explained in the article, a signal is emitted using the emit keyword or the Q_EMIT macro
                emit <signal_name>(<parameters_list>);
                
                Q_EMIT <signal_name>(<parameters_list>);
                
                1. Sometimes you need to signal what is changed and not only that something is changed

                2. the signal is the notification that something happened, parameters are details about the event

                S Offline
                S Offline
                Sunmuk
                wrote on last edited by
                #7

                @mcosta
                Thanks.....

                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