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. How to connect a custom message lambda
Forum Updated to NodeBB v4.3 + New Features

How to connect a custom message lambda

Scheduled Pinned Locked Moved Unsolved General and Desktop
17 Posts 4 Posters 1.0k 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.
  • J.HilkJ J.Hilk

    @IknowQT did you forward declare Standard_MeasureDataReceive and forgot to include the header?

    I Offline
    I Offline
    IknowQT
    wrote on last edited by
    #6

    @J-Hilk said in How to connect a custom message lambda:

    Standard_MeasureDataReceive

    has been declared. If it is not declared, I think there must have been a problem when it was used as a commonly used connect function, not a lambda function.

    J.HilkJ KroMignonK 2 Replies Last reply
    0
    • I IknowQT

      @J-Hilk said in How to connect a custom message lambda:

      Standard_MeasureDataReceive

      has been declared. If it is not declared, I think there must have been a problem when it was used as a commonly used connect function, not a lambda function.

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #7

      @IknowQT said in How to connect a custom message lambda:

      I think there must have been a problem when it was used as a commonly used connect function

      if you're using Qt5 connect syntax yes, with the Qt4 one above, not necessarily (straight away)


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      1 Reply Last reply
      0
      • I IknowQT

        @J-Hilk said in How to connect a custom message lambda:

        Standard_MeasureDataReceive

        has been declared. If it is not declared, I think there must have been a problem when it was used as a commonly used connect function, not a lambda function.

        KroMignonK Offline
        KroMignonK Offline
        KroMignon
        wrote on last edited by
        #8

        @IknowQT said in How to connect a custom message lambda:

        has been declared. If it is not declared, I think there must have been a problem when it was used as a commonly used connect function, not a lambda function.

        No necessary, when using SLOT() and SIGNAL() for the connect, there is no check done during compilation, only on runtime.
        signal / slot validity check on compilation is only done with new connection syntax.

        It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

        I 1 Reply Last reply
        0
        • KroMignonK KroMignon

          @IknowQT said in How to connect a custom message lambda:

          has been declared. If it is not declared, I think there must have been a problem when it was used as a commonly used connect function, not a lambda function.

          No necessary, when using SLOT() and SIGNAL() for the connect, there is no check done during compilation, only on runtime.
          signal / slot validity check on compilation is only done with new connection syntax.

          I Offline
          I Offline
          IknowQT
          wrote on last edited by IknowQT
          #9

          @KroMignon
          @J-Hilk

          this->connect(cGlobalParam::Communicator()->worker, SIGNAL(Signal_MeasureDataReceive(Standard_MeasureDataReceive)),
          		this, SLOT(Communicator_Event_MeasureDataReceive(Standard_MeasureDataReceive)));	
          
          void wStandardCurve::Communicator_Event_MeasureDataReceive(const Standard_MeasureDataReceive data)
          {
          	emit UserDefine_ReceiveData(data);
          }
          
          this->connect(this, &wStandardCurve::UserDefine_ReceiveData, [&](const Standard_MeasureDataReceive data)
          {
          	rcvData = data;
          });
          

          Communicator_Event_MeasureDataReceive -> UserDefine_ReceiveData -> lamba Func

          So what's the problem?
          I did one test. I generated singnal one more time and connected it with a lambda. It connects normally.

          The goal I want to use is to use the signal without going through it once more.

          jsulmJ KroMignonK 2 Replies Last reply
          0
          • I IknowQT

            @KroMignon
            @J-Hilk

            this->connect(cGlobalParam::Communicator()->worker, SIGNAL(Signal_MeasureDataReceive(Standard_MeasureDataReceive)),
            		this, SLOT(Communicator_Event_MeasureDataReceive(Standard_MeasureDataReceive)));	
            
            void wStandardCurve::Communicator_Event_MeasureDataReceive(const Standard_MeasureDataReceive data)
            {
            	emit UserDefine_ReceiveData(data);
            }
            
            this->connect(this, &wStandardCurve::UserDefine_ReceiveData, [&](const Standard_MeasureDataReceive data)
            {
            	rcvData = data;
            });
            

            Communicator_Event_MeasureDataReceive -> UserDefine_ReceiveData -> lamba Func

            So what's the problem?
            I did one test. I generated singnal one more time and connected it with a lambda. It connects normally.

            The goal I want to use is to use the signal without going through it once more.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #10

            @IknowQT said in How to connect a custom message lambda:

            The goal I want to use is to use the signal without going through it once more

            You can connect signals with other signals, not only signals with slots...

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            I 1 Reply Last reply
            1
            • jsulmJ jsulm

              @IknowQT said in How to connect a custom message lambda:

              The goal I want to use is to use the signal without going through it once more

              You can connect signals with other signals, not only signals with slots...

              I Offline
              I Offline
              IknowQT
              wrote on last edited by IknowQT
              #11

              @jsulm

              This is what I tested and shared.
              I don't know what is causing the link error in the lambda.

              1 Reply Last reply
              0
              • I IknowQT

                @KroMignon
                @J-Hilk

                this->connect(cGlobalParam::Communicator()->worker, SIGNAL(Signal_MeasureDataReceive(Standard_MeasureDataReceive)),
                		this, SLOT(Communicator_Event_MeasureDataReceive(Standard_MeasureDataReceive)));	
                
                void wStandardCurve::Communicator_Event_MeasureDataReceive(const Standard_MeasureDataReceive data)
                {
                	emit UserDefine_ReceiveData(data);
                }
                
                this->connect(this, &wStandardCurve::UserDefine_ReceiveData, [&](const Standard_MeasureDataReceive data)
                {
                	rcvData = data;
                });
                

                Communicator_Event_MeasureDataReceive -> UserDefine_ReceiveData -> lamba Func

                So what's the problem?
                I did one test. I generated singnal one more time and connected it with a lambda. It connects normally.

                The goal I want to use is to use the signal without going through it once more.

                KroMignonK Offline
                KroMignonK Offline
                KroMignon
                wrote on last edited by KroMignon
                #12

                @IknowQT said in How to connect a custom message lambda:

                So what's the problem?
                I did one test. I generated singnal one more time and connected it with a lambda. It connects normally.

                I am a little bit lost, is the signal signature Signal_MeasureDataReceive(Standard_MeasureDataReceive) or Signal_MeasureDataReceive(Standard_MeasureDataReceive*) ?

                It is an old maxim of mine that when you have excluded the impossible, whatever remains, however improbable, must be the truth. (Sherlock Holmes)

                I 1 Reply Last reply
                1
                • KroMignonK KroMignon

                  @IknowQT said in How to connect a custom message lambda:

                  So what's the problem?
                  I did one test. I generated singnal one more time and connected it with a lambda. It connects normally.

                  I am a little bit lost, is the signal signature Signal_MeasureDataReceive(Standard_MeasureDataReceive) or Signal_MeasureDataReceive(Standard_MeasureDataReceive*) ?

                  I Offline
                  I Offline
                  IknowQT
                  wrote on last edited by
                  #13

                  @KroMignon said in How to connect a custom message lambda:

                  I am a little bit lost, is the signal signature Signal_MeasureDataReceive(Standard_MeasureDataReceive) or Signal_MeasureDataReceive(Standard_MeasureDataReceive*) ?

                  To be exact, Signal_MeasureDataReceive(Standard_MeasureDataReceive).

                  J.HilkJ 1 Reply Last reply
                  0
                  • I IknowQT

                    @KroMignon said in How to connect a custom message lambda:

                    I am a little bit lost, is the signal signature Signal_MeasureDataReceive(Standard_MeasureDataReceive) or Signal_MeasureDataReceive(Standard_MeasureDataReceive*) ?

                    To be exact, Signal_MeasureDataReceive(Standard_MeasureDataReceive).

                    J.HilkJ Offline
                    J.HilkJ Offline
                    J.Hilk
                    Moderators
                    wrote on last edited by
                    #14

                    @IknowQT said in How to connect a custom message lambda:

                    @KroMignon said in How to connect a custom message lambda:

                    I am a little bit lost, is the signal signature Signal_MeasureDataReceive(Standard_MeasureDataReceive) or Signal_MeasureDataReceive(Standard_MeasureDataReceive*) ?

                    To be exact, Signal_MeasureDataReceive(Standard_MeasureDataReceive).

                    why do you tell the QOverload and the lambda argument that its a pointer?

                    QOverload<Standard_MeasureDataReceive*>::of(&TcpClientThreadDoWork::Signal_MeasureDataReceive),
                    		[=](Standard_MeasureDataReceive* data)
                    

                    Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                    Q: What's that?
                    A: It's blue light.
                    Q: What does it do?
                    A: It turns blue.

                    I 1 Reply Last reply
                    1
                    • J.HilkJ J.Hilk

                      @IknowQT said in How to connect a custom message lambda:

                      @KroMignon said in How to connect a custom message lambda:

                      I am a little bit lost, is the signal signature Signal_MeasureDataReceive(Standard_MeasureDataReceive) or Signal_MeasureDataReceive(Standard_MeasureDataReceive*) ?

                      To be exact, Signal_MeasureDataReceive(Standard_MeasureDataReceive).

                      why do you tell the QOverload and the lambda argument that its a pointer?

                      QOverload<Standard_MeasureDataReceive*>::of(&TcpClientThreadDoWork::Signal_MeasureDataReceive),
                      		[=](Standard_MeasureDataReceive* data)
                      
                      I Offline
                      I Offline
                      IknowQT
                      wrote on last edited by
                      #15

                      @J-Hilk

                      Declaring a pointer class is just a test case.
                      The same lnk error occurs for pointer classes and regular classes.

                      J.HilkJ 1 Reply Last reply
                      0
                      • I IknowQT

                        @J-Hilk

                        Declaring a pointer class is just a test case.
                        The same lnk error occurs for pointer classes and regular classes.

                        J.HilkJ Offline
                        J.HilkJ Offline
                        J.Hilk
                        Moderators
                        wrote on last edited by
                        #16

                        @IknowQT
                        Can you even use Lambdas ?

                        what's your Qt version, c++ Version and compiler?


                        Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                        Q: What's that?
                        A: It's blue light.
                        Q: What does it do?
                        A: It turns blue.

                        I 1 Reply Last reply
                        0
                        • J.HilkJ J.Hilk

                          @IknowQT
                          Can you even use Lambdas ?

                          what's your Qt version, c++ Version and compiler?

                          I Offline
                          I Offline
                          IknowQT
                          wrote on last edited by
                          #17

                          @J-Hilk

                          C:\Qt\5.15.2\msvc2019_64
                          That is all.

                          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