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. Strange "No such signal" error

Strange "No such signal" error

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

    I'm experiencing a very strange problem with signal/slot connection. The architecture of my program is fairly complex, but it boils down to the following:

    There is a C++/Qt library (Library 1) with two classes, A and B. Class A as a signal (Signal 1A), class B has a slot (Slot 1B) and a signal (Signal 1B). In the class B constructor a connection is made between Signal 1A and Slot 1B. The library is compiled using MSVC2013.

    There is another library (Library 2) for use in C# applications, compiled with the /CLR flag, also using MSVC2013. It is a "bridge" class for calls and for translating signals into C# events. It has slots Slot 2A and Slot 2B for connecting to Signal 1A and Signal 1B. The library is used in a test C# application.

    In all cases I use the new slot/signal connection syntax, checked at compile time. Slot 2A to Signal 1A and Slot 2B to Signal 1B connections work without any problem, as well as the following translations to C# events. But when the program tries to make Signal 1A to Slot 1B (inside Library 1, compiled to native code!), it prints an error: QObject::connect: No such signal <Signal 1A>. I cannot understand how can it be, the signal definitely exists and it is successfully connected to another slot in Library 2! Is it a Qt bug?

    D 1 Reply Last reply
    0
    • E Offline
      E Offline
      Eeli K
      wrote on last edited by
      #2

      It's a bit difficult to follow all these As, Bs, 1s, 2, classes and libraries. First you say Library 2, then Library B.

      A 1 Reply Last reply
      0
      • E Eeli K

        It's a bit difficult to follow all these As, Bs, 1s, 2, classes and libraries. First you say Library 2, then Library B.

        A Offline
        A Offline
        A1exander_V_Z
        wrote on last edited by
        #3

        @Eeli-K Library 2, of course, that is an error. I've edited the post.

        1 Reply Last reply
        0
        • A A1exander_V_Z

          I'm experiencing a very strange problem with signal/slot connection. The architecture of my program is fairly complex, but it boils down to the following:

          There is a C++/Qt library (Library 1) with two classes, A and B. Class A as a signal (Signal 1A), class B has a slot (Slot 1B) and a signal (Signal 1B). In the class B constructor a connection is made between Signal 1A and Slot 1B. The library is compiled using MSVC2013.

          There is another library (Library 2) for use in C# applications, compiled with the /CLR flag, also using MSVC2013. It is a "bridge" class for calls and for translating signals into C# events. It has slots Slot 2A and Slot 2B for connecting to Signal 1A and Signal 1B. The library is used in a test C# application.

          In all cases I use the new slot/signal connection syntax, checked at compile time. Slot 2A to Signal 1A and Slot 2B to Signal 1B connections work without any problem, as well as the following translations to C# events. But when the program tries to make Signal 1A to Slot 1B (inside Library 1, compiled to native code!), it prints an error: QObject::connect: No such signal <Signal 1A>. I cannot understand how can it be, the signal definitely exists and it is successfully connected to another slot in Library 2! Is it a Qt bug?

          D Offline
          D Offline
          DRoscoe
          wrote on last edited by
          #4

          @A1exander_V_Z I think you need to provide a more concrete example, preferably showing the actual code that is not working. When you are making your connection, do not provide variable names, only the data type. If you provide a variable name, it will not work.

          A 1 Reply Last reply
          1
          • D DRoscoe

            @A1exander_V_Z I think you need to provide a more concrete example, preferably showing the actual code that is not working. When you are making your connection, do not provide variable names, only the data type. If you provide a variable name, it will not work.

            A Offline
            A Offline
            A1exander_V_Z
            wrote on last edited by kshegunov
            #5

            @DRoscoe I'm using the new syntax with only signal and slot names. They are not overloaded, so there is no need to mention parameters at all.

            Connection of Signal 1A to Slot 2A (which is working) looks like this:

            connect(device, &Device::OnDataReady, this, &Bridge::onDataReady);
            

            Connection of Signal 1A to Slot 1B (which causes and error) looks like this:

            connect(at_dev, &Device::OnDataReady, this, &B::catchData);
            

            The signatures of all functions (signals and slots) are identical.

            D M 2 Replies Last reply
            0
            • A A1exander_V_Z

              @DRoscoe I'm using the new syntax with only signal and slot names. They are not overloaded, so there is no need to mention parameters at all.

              Connection of Signal 1A to Slot 2A (which is working) looks like this:

              connect(device, &Device::OnDataReady, this, &Bridge::onDataReady);
              

              Connection of Signal 1A to Slot 1B (which causes and error) looks like this:

              connect(at_dev, &Device::OnDataReady, this, &B::catchData);
              

              The signatures of all functions (signals and slots) are identical.

              D Offline
              D Offline
              DRoscoe
              wrote on last edited by
              #6

              @A1exander_V_Z Ok, that's a bit better, you're using the function pointer variant. Can you post the exact error you are seeing? When I see these, the error usually tells me exactly what's going on

              1 Reply Last reply
              2
              • A A1exander_V_Z

                @DRoscoe I'm using the new syntax with only signal and slot names. They are not overloaded, so there is no need to mention parameters at all.

                Connection of Signal 1A to Slot 2A (which is working) looks like this:

                connect(device, &Device::OnDataReady, this, &Bridge::onDataReady);
                

                Connection of Signal 1A to Slot 1B (which causes and error) looks like this:

                connect(at_dev, &Device::OnDataReady, this, &B::catchData);
                

                The signatures of all functions (signals and slots) are identical.

                M Offline
                M Offline
                mchinand
                wrote on last edited by
                #7

                Since the connect statement that is giving the error is in the class B constructor, are you passing a reference to a class A object to the class B constructor or creating a class A object in the class B constructor?

                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