Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. signals as functions (compiler warning)

signals as functions (compiler warning)

Scheduled Pinned Locked Moved Solved Qt Creator and other tools
3 Posts 3 Posters 3.5k Views 1 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.
  • C Offline
    C Offline
    Circuits
    wrote on last edited by
    #1

    Hey guys, so I have a signal:

    in header:

    signals:
    
      foo();
    

    and I am emiting the signal like so:

    in .cpp:

    void bar()
    {
      emit foo();
    }
    

    There, on the emit line, I am getting a compiler warning:

    "Emit keyword being used with non-signal"

    I only recently stated seeing these warnings after updating Qt. Why am I getting this warning?

    ODБOïO 1 Reply Last reply
    0
    • C Circuits

      Hey guys, so I have a signal:

      in header:

      signals:
      
        foo();
      

      and I am emiting the signal like so:

      in .cpp:

      void bar()
      {
        emit foo();
      }
      

      There, on the emit line, I am getting a compiler warning:

      "Emit keyword being used with non-signal"

      I only recently stated seeing these warnings after updating Qt. Why am I getting this warning?

      ODБOïO Offline
      ODБOïO Offline
      ODБOï
      wrote on last edited by
      #3

      hi
      @Circuits said in signals as functions (compiler warning):

      "Emit keyword being used with non-signal"

      In addition to what Christian said,
      that warning will also be thrown if you have a signal and a method/slot with the same name

      public slots:
          void test(){        
              return;    
          }
      signals:
          void test(int &i);
      
      [...]
      {
       emit test();  // Emit keyword being used with non-signal [clazy-incorrect-emit]
      }
      
      1 Reply Last reply
      4
      • Christian EhrlicherC Offline
        Christian EhrlicherC Offline
        Christian Ehrlicher
        Lifetime Qt Champion
        wrote on last edited by Christian Ehrlicher
        #2

        Did you add Q_OBJECT to your class? If so I would guess the code model is a little bit confused and you can safely ignore it.

        /edit: moving to 'Tools' since it's not a Qt but a QtCreator problem.

        Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
        Visit the Qt Academy at https://academy.qt.io/catalog

        1 Reply Last reply
        3
        • C Circuits

          Hey guys, so I have a signal:

          in header:

          signals:
          
            foo();
          

          and I am emiting the signal like so:

          in .cpp:

          void bar()
          {
            emit foo();
          }
          

          There, on the emit line, I am getting a compiler warning:

          "Emit keyword being used with non-signal"

          I only recently stated seeing these warnings after updating Qt. Why am I getting this warning?

          ODБOïO Offline
          ODБOïO Offline
          ODБOï
          wrote on last edited by
          #3

          hi
          @Circuits said in signals as functions (compiler warning):

          "Emit keyword being used with non-signal"

          In addition to what Christian said,
          that warning will also be thrown if you have a signal and a method/slot with the same name

          public slots:
              void test(){        
                  return;    
              }
          signals:
              void test(int &i);
          
          [...]
          {
           emit test();  // Emit keyword being used with non-signal [clazy-incorrect-emit]
          }
          
          1 Reply Last reply
          4

          • Login

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