Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Signal not emitted or not received
Qt 6.12 LTS is out! See what's new in the release blog

Signal not emitted or not received

Scheduled Pinned Locked Moved Solved General and Desktop
34 Posts 4 Posters 28.9k 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.
  • M MScottM

    @JKSH - regarding posting my code - I think I can pare down the code I've added to the example, but I don't think I could figure out what to cut from the example code, and maybe how I integrated it is part of the issue...? Would it be okay to just post the pared down part that I added to the example code?

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

    @mscottm said in Signal not emitted or not received:

    I think I can pare down the code I've added to the example, but I don't think I could figure out what to cut from the example code, and maybe how I integrated it is part of the issue...? Would it be okay to just post the pared down part that I added to the example code?

    Sure, go ahead.

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

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MScottM
      wrote on last edited by
      #26

      @JKSH

      Okay - I wasted another week and a half trying to solve this myself with no result :(

      Not sure how to pass along my minimized code - is there a way to attach a zip? Even though it's shortened, it seems like a lot to paste here.

      mrjjM JKSHJ 2 Replies Last reply
      0
      • M MScottM

        @JKSH

        Okay - I wasted another week and a half trying to solve this myself with no result :(

        Not sure how to pass along my minimized code - is there a way to attach a zip? Even though it's shortened, it seems like a lot to paste here.

        mrjjM Offline
        mrjjM Offline
        mrjj
        Lifetime Qt Champion
        wrote on last edited by mrjj
        #27

        @MScottM
        Hi
        The upload here is not so cooperative with zip files.
        alt text

        So you have to use some upload service (google drive, pcloud or similar)
        that can give an URL to paste here.
        https://wetransfer.com/ can also do it with no install
        if you swich to "send as link" mode.
        using the the round [...] button.

        1 Reply Last reply
        1
        • M MScottM

          @JKSH

          Okay - I wasted another week and a half trying to solve this myself with no result :(

          Not sure how to pass along my minimized code - is there a way to attach a zip? Even though it's shortened, it seems like a lot to paste here.

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

          @MScottM said in Signal not emitted or not received:

          Not sure how to pass along my minimized code - is there a way to attach a zip?

          Like @mrjj said, upload your zip file to an external file host and post the link here.

          Okay - I wasted another week and a half trying to solve this myself with no result :(
          ...
          Even though it's shortened, it seems like a lot to paste here.

          Thank you for making the effort. Upload the zip file containing your whole project (so that I can just click "build" and run it -- it doesn't matter if I need a CAN bus device); I'm happy to look through your work.

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

          1 Reply Last reply
          2
          • M Offline
            M Offline
            MScottM
            wrote on last edited by MScottM
            #29

            Here is the link to a zip file:

            https://we.tl/t-jlLJoUCTvs

            Notes:
            There is a text file needed (included in file) that goes into the build folder. Steps to test my non-working signal (in pMessageProcessor.cpp):

            CAN cable isn't needed - on running the program:
            Select 'virtualcan' from drop down
            Check 'Custom Configuration' and set 'Receive Own' to True - click OK
            At menu on top click Monitor -> P Bus
            In center box click 'Module 1'

            (Back to Can Example Window)
            Check 'Extended Format' and in the 'Frame ID' box type FF0400
            In the 'Payload' box type eight bytes, i.e. 11 22 33 44 55 66 77 88 and send

            Thank you for taking the time to take a look!

            JKSHJ 1 Reply Last reply
            0
            • M MScottM

              Here is the link to a zip file:

              https://we.tl/t-jlLJoUCTvs

              Notes:
              There is a text file needed (included in file) that goes into the build folder. Steps to test my non-working signal (in pMessageProcessor.cpp):

              CAN cable isn't needed - on running the program:
              Select 'virtualcan' from drop down
              Check 'Custom Configuration' and set 'Receive Own' to True - click OK
              At menu on top click Monitor -> P Bus
              In center box click 'Module 1'

              (Back to Can Example Window)
              Check 'Extended Format' and in the 'Frame ID' box type FF0400
              In the 'Payload' box type eight bytes, i.e. 11 22 33 44 55 66 77 88 and send

              Thank you for taking the time to take a look!

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

              @MScottM OK, I've downloaded your code and am looking through it. I will probably post back in the next day or two.

              In the meantime, I've got a few questions:

              1. You have two different instances of pMessageProcessor in your code (one is a member variable in MainWindow, the other is in your main.cpp). Which one did you intend to use? (Similarly, you have 2 different instances of QQmlEngine)
                • An important part of minimizing your code for troubleshooting is to get rid of unneeded objects.
              2. You mentioned that this is a "learning project". Could you describe what you're focussing on learning?
                • Is it learning to use Qt's CAN classes? Learning to integrate C++ and QML? Learning how to create GUIs in QML? A combination of the above? Something else completely?

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

              1 Reply Last reply
              4
              • M Offline
                M Offline
                MScottM
                wrote on last edited by MScottM
                #31

                Hi @JKSH

                Again, thanks for taking the time to look through what I've done.

                To answer your questions in reverse order:

                1. The simple answer is 'all of the above'. A part of my job includes working with equipment that uses CAN bus to communicate, and I thought it would be interesting to learn some more about Qt while making a tool that could be useful for me when troubleshooting. Integrating QML GUIs with C++ seems like the best way to make interesting useful programs. While I've had one or two formal classes in programming (enough to make me dangerous), I'm in no way a computer science major, and I apologize for the amateur mistakes I must be making!

                2. With respect to QQmlEngine, I was wondering, and asked in one of my posts above, whether it was an issue to create a second one, and if that might be part of my problem. Regarding pMessageProcessor, I added that to main.cpp in order to get the connect statement working, as I couldn't seem to get it to work anywhere else.

                Edit: that's interesting...the forum is auto numbering my replies!

                JKSHJ 1 Reply Last reply
                0
                • M MScottM

                  Hi @JKSH

                  Again, thanks for taking the time to look through what I've done.

                  To answer your questions in reverse order:

                  1. The simple answer is 'all of the above'. A part of my job includes working with equipment that uses CAN bus to communicate, and I thought it would be interesting to learn some more about Qt while making a tool that could be useful for me when troubleshooting. Integrating QML GUIs with C++ seems like the best way to make interesting useful programs. While I've had one or two formal classes in programming (enough to make me dangerous), I'm in no way a computer science major, and I apologize for the amateur mistakes I must be making!

                  2. With respect to QQmlEngine, I was wondering, and asked in one of my posts above, whether it was an issue to create a second one, and if that might be part of my problem. Regarding pMessageProcessor, I added that to main.cpp in order to get the connect statement working, as I couldn't seem to get it to work anywhere else.

                  Edit: that's interesting...the forum is auto numbering my replies!

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

                  @MScottM You're most welcome! Always happy to help a willing learner.

                  With respect to QQmlEngine, I was wondering, and asked in one of my posts above, whether it was an issue to create a second one, and if that might be part of my problem.

                  Yes, that is definitely part of your problem. The diagram below summarizes your code:

                  Connection Diagram

                  (Red arrows show signal-slot connections; Blue lines show QML contexts)

                  You have created 2 separate message processors and 2 separate QML engines.

                  • Your first pMessageProcessor (in main.cpp) receives the MainWindow::canMessageOut() signal. However, you have not connected anything to this pMessageProcessor's signals.
                  • Your second pMessageProcessor(in mainwindow.h) has its signals connected to the signal handlers ModulePage. However, it does not receiveMainWindow::canMessageOut() so it never emits its signals.

                  From the diagram, can you see what needs to happen for your code to work as you want? Try to implement the change in your code. If you can't figure it out, describe what you want to do and I'll give you some pointers.

                  The simple answer is 'all of the above'. A part of my job includes working with equipment that uses CAN bus to communicate, and I thought it would be interesting to learn some more about Qt while making a tool that could be useful for me when troubleshooting.

                  When learning multiple new concepts, I recommend the "divide and conquer" approach. Focus on one thing at a time -- you will be able to learn much faster this way. Mixing multiple concepts into the same study makes it much harder to troubleshoot things.

                  While I've had one or two formal classes in programming (enough to make me dangerous), I'm in no way a computer science major, and I apologize for the amateur mistakes I must be making!

                  You don't need a computer science major to learn Qt, but you do need to be systematic and patient.

                  Integrating QML GUIs with C++ seems like the best way to make interesting useful programs.

                  You can absolutely make interesting useful programs using Qt Widgets too.

                  Since the CAN example already has a solid GUI based on Qt Widgets, I highly recommend you first learn by adding new functionality to that example by implementing new widgets. Leave QML out of it for now.

                  Add QML after you have mastered widgets, or implement QML in a separate, smaller, and simpler project which doesn't have such a complex web of connections.

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

                  1 Reply Last reply
                  3
                  • M Offline
                    M Offline
                    MScottM
                    wrote on last edited by
                    #33

                    Hi @JKSH ,

                    THANK YOU!! Your diagram made what was happening very clear. I'll try to use something like that in the future when plotting connections.

                    I made the following changes, and now it works as I expected it to:

                    I deleted the contextProperty statements and moved the class declaration and connect statement out of main.cpp and placed them in MainWindow.cpp, as well as creating the QQmlApplicationEngines and setting the engine context properties in the same place - eliminating 'engine1', and that was basically all it took!

                    When learning multiple new concepts, I recommend the "divide and conquer" approach. Focus on one thing at a time -- you will be able to learn much faster this way. Mixing multiple concepts into the same study makes it much harder to troubleshoot things.

                    I appreciate this advice, and this is actually what I try do. When I tackle a new concept, I'll create a small application that does only the thing I'm trying to learn, but then I'll try to fit that functionality into a larger application that has more going on. This is actually sort of a culmination of trying different concepts, but I obviously bit off more that I could chew. This is the first time I've tried taking code that was complete and working (the CAN example) and adding my own functionality. I have made other small applications that combine QML and C++.

                    Since the CAN example already has a solid GUI based on Qt Widgets, I highly recommend you first learn by adding new functionality to that example by implementing new widgets. Leave QML out of it for now.

                    Add QML after you have mastered widgets, or implement QML in a separate, smaller, and simpler project which doesn't have such a complex web of connections.

                    I find QML very easy to work with and Qt Widgets, not so much, (although I have created small GUI's strictly with Qt Widgets before). This tells me you're probably right about learning more about the Widgets framework.

                    JKSHJ 1 Reply Last reply
                    2
                    • M MScottM

                      Hi @JKSH ,

                      THANK YOU!! Your diagram made what was happening very clear. I'll try to use something like that in the future when plotting connections.

                      I made the following changes, and now it works as I expected it to:

                      I deleted the contextProperty statements and moved the class declaration and connect statement out of main.cpp and placed them in MainWindow.cpp, as well as creating the QQmlApplicationEngines and setting the engine context properties in the same place - eliminating 'engine1', and that was basically all it took!

                      When learning multiple new concepts, I recommend the "divide and conquer" approach. Focus on one thing at a time -- you will be able to learn much faster this way. Mixing multiple concepts into the same study makes it much harder to troubleshoot things.

                      I appreciate this advice, and this is actually what I try do. When I tackle a new concept, I'll create a small application that does only the thing I'm trying to learn, but then I'll try to fit that functionality into a larger application that has more going on. This is actually sort of a culmination of trying different concepts, but I obviously bit off more that I could chew. This is the first time I've tried taking code that was complete and working (the CAN example) and adding my own functionality. I have made other small applications that combine QML and C++.

                      Since the CAN example already has a solid GUI based on Qt Widgets, I highly recommend you first learn by adding new functionality to that example by implementing new widgets. Leave QML out of it for now.

                      Add QML after you have mastered widgets, or implement QML in a separate, smaller, and simpler project which doesn't have such a complex web of connections.

                      I find QML very easy to work with and Qt Widgets, not so much, (although I have created small GUI's strictly with Qt Widgets before). This tells me you're probably right about learning more about the Widgets framework.

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

                      @MScottM said in Signal not emitted or not received:

                      I made the following changes, and now it works as I expected it to:

                      Congrats! Happy coding.

                      Your diagram made what was happening very clear. I'll try to use something like that in the future when plotting connections.

                      A pen and paper are very powerful programming tools.

                      I appreciate this advice, and this is actually what I try do. When I tackle a new concept, I'll create a small application that does only the thing I'm trying to learn, but then I'll try to fit that functionality into a larger application that has more going on.... I have made other small applications that combine QML and C++.

                      OK, it sounds like you have a good systematic workflow.

                      I find QML very easy to work with and Qt Widgets, not so much, (although I have created small GUI's strictly with Qt Widgets before). This tells me you're probably right about learning more about the Widgets framework.

                      The ranking from easiest-to-hardest is roughly:

                      1. Pure QML
                      2. Pure C++
                      3. Mixing QML and C++

                      #3 depends on your ability to do #1 and #2, so you'll most likely benefit from strengthening your understanding of C++.

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

                      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
                      • Unsolved