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. Signals and slots or whatever
Qt 6.12 LTS is out! See what's new in the release blog

Signals and slots or whatever

Scheduled Pinned Locked Moved Unsolved General and Desktop
71 Posts 6 Posters 40.1k 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.
  • VRoninV VRonin

    @jrod2much said in Signals and slots or whatever:

    What should be my next step?

    Make the interpreter a QObject if it's not already and declare a signal identical to the one in CccModule.
    Now wherever the interpreter creates the CccModule connect() the 2 signals together

    The following step is finding out how interpreter gets created (by MainWindow?) it might be tricky as it's in a secondary thread but try and have a look

    VRoninV Offline
    VRoninV Offline
    VRonin
    wrote on last edited by
    #56

    I think you skipped this part:

    @VRonin said in Signals and slots or whatever:

    Now wherever the interpreter creates the CccModule connect() the 2 signals together

    "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
    ~Napoleon Bonaparte

    On a crusade to banish setIndexWidget() from the holy land of Qt

    J 1 Reply Last reply
    1
    • VRoninV VRonin

      I think you skipped this part:

      @VRonin said in Signals and slots or whatever:

      Now wherever the interpreter creates the CccModule connect() the 2 signals together

      J Offline
      J Offline
      jrod2much
      wrote on last edited by jrod2much
      #57

      @VRonin So I have changed where I am trying to get the value from, it is actually from the Renderer class, not the CccModule class anymore.

      New error

      QObject::connect: Cannot connect (null)::Rvalues(QString) to QTextBrowser::setText(QString)

      VRoninV jsulmJ 2 Replies Last reply
      0
      • J jrod2much

        @VRonin So I have changed where I am trying to get the value from, it is actually from the Renderer class, not the CccModule class anymore.

        New error

        QObject::connect: Cannot connect (null)::Rvalues(QString) to QTextBrowser::setText(QString)

        VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by
        #58

        @jrod2much said in Signals and slots or whatever:

        So I have changed where I am trying to get the value from

        I see, cool

        New error

        Could you use Qt5 connection instead? errors usually are a lot more helpful:
        connect(m_interpreter->m_renderer,&Renderer::Rvalues,m_ui->textBrowser,&QTextBrowser::setText);

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        1 Reply Last reply
        2
        • J Offline
          J Offline
          jrod2much
          wrote on last edited by jrod2much
          #59

          @VRonin

          0_1538488320685_0cf79aa7-0b80-425b-b65a-2d0608dd88f4-image.png

          15:51:34: Debugging starts
          (Internal error: pc 0x0 in read in psymtab, but not in symtab.)
          (Internal error: pc 0x0 in read in psymtab, but not in symtab.)

          @VRonin said in Signals and slots or whatever:

          If you remove the connect you get no such error, correct?

          UPDATE: correct

          1 Reply Last reply
          0
          • VRoninV Offline
            VRoninV Offline
            VRonin
            wrote on last edited by
            #60

            If you remove the connect you get no such error, correct?

            "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
            ~Napoleon Bonaparte

            On a crusade to banish setIndexWidget() from the holy land of Qt

            J 1 Reply Last reply
            0
            • VRoninV VRonin

              If you remove the connect you get no such error, correct?

              J Offline
              J Offline
              jrod2much
              wrote on last edited by
              #61

              @VRonin said in Signals and slots or whatever:

              If you remove the connect you get no such error, correct?

              correct

              1 Reply Last reply
              0
              • VRoninV Offline
                VRoninV Offline
                VRonin
                wrote on last edited by
                #62

                1st try, move the connect as the very last line in the function. if that isn't enough then you have to find out where m_interpreter->m_renderer and m_ui->textBrowser are created and connect after they are created

                "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                ~Napoleon Bonaparte

                On a crusade to banish setIndexWidget() from the holy land of Qt

                1 Reply Last reply
                1
                • J jrod2much

                  @VRonin So I have changed where I am trying to get the value from, it is actually from the Renderer class, not the CccModule class anymore.

                  New error

                  QObject::connect: Cannot connect (null)::Rvalues(QString) to QTextBrowser::setText(QString)

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

                  @jrod2much said in Signals and slots or whatever:

                  QObject::connect: Cannot connect (null)::Rvalues(QString) to QTextBrowser::setText(QString)

                  You're using a nullptr to connect, this can't work. The sender object was not created.

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

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    jrod2much
                    wrote on last edited by
                    #64

                    @jsulm Is this what you are talking about:

                    #include "console.h"
                    #include "interpreter.h"
                    #include "chirpmon.h"
                    #include "dfu.h"
                    #include "flash.h"
                    #include "ui_mainwindow.h"
                    #include "configdialog.h"
                    #include "dataexport.h"
                    #include "sleeper.h"
                    #include "aboutdialog.h"
                    #include "parameters.h"
                    #include "paramfile.h"
                    #include <QTextBrowser>
                    #include "renderer.h"
                    
                    extern ChirpProc c_grabFrame;
                    
                    MainWindow::MainWindow(int argc, char *argv[], QWidget *parent) :
                        QMainWindow(parent),
                        m_ui(new Ui::MainWindow)
                    {
                        QCoreApplication::setOrganizationName(PIXYMON_COMPANY);
                        QCoreApplication::setApplicationName(PIXYMON_TITLE);
                    
                        qRegisterMetaType<Device>("Device");
                    
                        m_ui->setupUi(this);
                        setWindowTitle(PIXYMON_TITLE);
                    
                        m_interpreter = NULL;
                        connect(m_interpreter->m_renderer,&Renderer::Rvalues,m_ui->textBrowser,&QTextBrowser::setText);
                        m_flash = NULL;
                        m_renderer = NULL;  //<-------------------------This?
                        m_pixyConnected = false;
                        m_pixyDFUConnected = false;
                        m_configDialog = NULL;
                        m_fwInstructions = NULL;
                        m_fwMessage = NULL;
                        m_versionIncompatibility = false;
                        m_testCycle = false;
                        m_waiting = WAIT_NONE;
                    
                        parseCommandline(argc, argv);
                    
                        m_settings = new QSettings(QSettings::NativeFormat, QSettings::UserScope, PIXYMON_COMPANY, PIXYMON_TITLE);
                        m_console = new ConsoleWidget(this);
                        m_video = new VideoWidget(this);
                        connect(m_video, SIGNAL(mouseLoc(int,int)), this, SLOT(handleMouseLoc(int, int)));
                    
                        m_ui->imageLayout->addWidget(m_video);
                        m_ui->imageLayout->addWidget(m_console);
                    
                        // hide console
                        m_showConsole = m_testCycle;
                        m_console->setVisible(m_testCycle);
                        m_ui->actionConsole->setChecked(m_testCycle);
                    
                        m_ui->toolBar->addAction(m_ui->actionPlay_Pause);
                    
                        m_ui->actionDefault_program->setIcon(QIcon(":/icons/icons/home.png"));
                        m_ui->toolBar->addAction(m_ui->actionDefault_program);
                    
                        m_ui->actionRaw_video->setIcon(QIcon(":/icons/icons/raw.png"));
                        m_ui->toolBar->addAction(m_ui->actionRaw_video);
                    
                        m_ui->actionConfigure->setIcon(QIcon(":/icons/icons/config.png"));
                        m_ui->toolBar->addAction(m_ui->actionConfigure);
                    
                        m_ui->menuProgram->setToolTipsVisible(true);
                    
                        m_statusLeft = new QLabel;
                        m_statusRight = new QLabel;
                        // give the status a little of a left margin
                        m_ui->statusBar->setContentsMargins(6, 0, 0, 0);
                        m_ui->statusBar->addWidget(m_statusLeft);
                        m_ui->statusBar->addPermanentWidget(m_statusRight);
                        updateButtons();
                    
                        m_parameters.add("Pixy start command", PT_STRING, "",
                            "The command that is sent to Pixy upon initialization");
                    
                        // start looking for devices
                        m_connect = new ConnectEvent(this);
                        if (m_connect->getConnected()==NONE)
                            error("No Pixy devices have been detected.\n");
                    
                        //  <---My added expermiental code ------v
                        //connect(m_renderer,SIGNAL(Rvalues(QString)), m_ui->textBrowser, SLOT(setText(QString)));
                       // connect(m_interpreter->m_renderer,&Renderer::Rvalues,m_ui->textBrowser,&QTextBrowser::setText);
                    
                    }
                    
                    1 Reply Last reply
                    0
                    • VRoninV Offline
                      VRoninV Offline
                      VRonin
                      wrote on last edited by
                      #65

                      ok. stop a second and think.
                      What are you doing here?

                      m_interpreter = NULL;
                      connect(m_interpreter->m_renderer
                      

                      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                      ~Napoleon Bonaparte

                      On a crusade to banish setIndexWidget() from the holy land of Qt

                      J 1 Reply Last reply
                      5
                      • VRoninV VRonin

                        ok. stop a second and think.
                        What are you doing here?

                        m_interpreter = NULL;
                        connect(m_interpreter->m_renderer
                        
                        J Offline
                        J Offline
                        jrod2much
                        wrote on last edited by jrod2much
                        #66

                        @VRonin said in Signals and slots or whatever:

                        m_interpreter = NULL;
                        connect(m_interpreter->m_renderer
                        

                        I'm not really sure what this means. This is my interpretation of the code; The application runs without my connect function or any other alteration to the code. So, I would guess it would be a bad idea to create an object where the original Programmers of this code did not. Wouldn't that affect the program? That is my uneducated opinion.

                        JKSHJ 1 Reply Last reply
                        0
                        • J jrod2much

                          @VRonin said in Signals and slots or whatever:

                          m_interpreter = NULL;
                          connect(m_interpreter->m_renderer
                          

                          I'm not really sure what this means. This is my interpretation of the code; The application runs without my connect function or any other alteration to the code. So, I would guess it would be a bad idea to create an object where the original Programmers of this code did not. Wouldn't that affect the program? That is my uneducated opinion.

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

                          @jrod2much said in Signals and slots or whatever:

                          I'm not really sure what this means.

                          Let's simplify it further.

                          m_interpreter = NULL;
                          m_interpreter->m_renderer
                          

                          Line 1: You make m_interpreter a null pointer.
                          Line 2: You dereference the null pointer.

                          What do you think will happen when you dereference a null pointer?

                          Note: This is a very important, fundamental concept in C++. If it's unclear to you, I highly recommend you spend some time learning C++ first, before you attempt to modify a complex application.

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

                          J 1 Reply Last reply
                          2
                          • JKSHJ JKSH

                            @jrod2much said in Signals and slots or whatever:

                            I'm not really sure what this means.

                            Let's simplify it further.

                            m_interpreter = NULL;
                            m_interpreter->m_renderer
                            

                            Line 1: You make m_interpreter a null pointer.
                            Line 2: You dereference the null pointer.

                            What do you think will happen when you dereference a null pointer?

                            Note: This is a very important, fundamental concept in C++. If it's unclear to you, I highly recommend you spend some time learning C++ first, before you attempt to modify a complex application.

                            J Offline
                            J Offline
                            jrod2much
                            wrote on last edited by
                            #68

                            @JKSH Alright so I read up on the subject and I think I understand. A null pointer does not point to an address so it can't be dereferenced. I also found this video that made me feel stupid.
                            https://www.youtube.com/watch?v=bLHL75H_VEM

                            Alright so what is my next step. Should I eliminate the two lines of code that make m_interpreter and m_renderer NULL? or do I have to point it to a specific address value?

                            JKSHJ 1 Reply Last reply
                            0
                            • J Offline
                              J Offline
                              jrod2much
                              wrote on last edited by
                              #69

                              @JKSH @VRonin @jsulm @J-Hilk
                              GUYS WE DID IT!!!!!!!!!!!!! ITS OUTPUTING THE VALUES!!!!
                              0_1538646514714_02a43331-64d9-4717-990d-2c1101843a9f-image.png
                              I searched the code for the whatever you call it when you make a new object and placed the connect function that @VRonin gave me there and BOOM

                              ...
                                }
                                                  dir = fd.directory().absolutePath();
                                                  m_settings->setValue("fw_dialog", QVariant(dir));
                                              }
                                          }
                                          else if (m_interpreter==NULL)
                                          {
                                              m_console->clear();
                                              m_console->print("Pixy detected.\n");
                              
                                              m_interpreter = new Interpreter(m_console, m_video, &m_parameters, m_initScript);
                              
                                              connect(m_interpreter->m_renderer,&Renderer::Rvalues,m_ui->textBrowser,&QTextBrowser::setText); //Added
                              
                                              connect(m_interpreter, SIGNAL(error(QString)), this, SLOT(error(QString)));
                                              connect(m_interpreter, SIGNAL(textOut(QString,uint)), this, SLOT(handleText(QString,uint)));
                                              connect(m_interpreter, SIGNAL(runState(int,QString)), this, SLOT(handleRunState(int,QString)));
                                              connect(m_interpreter, SIGNAL(finished()), this, SLOT(interpreterFinished())); // thread will send finished event when it exits
                                              connect(m_interpreter, SIGNAL(connected(Device,bool)), this, SLOT(handleConnected(Device,bool)));
                                              connect(m_interpreter, SIGNAL(actionScriptlet(QString,QStringList,bool)), this, SLOT(handleActionScriptlet(QString,QStringList,bool)));
                                              connect(m_interpreter, SIGNAL(view(QString,uint,bool,bool)), this, SLOT(handleView(QString,uint,bool,bool)));
                                              connect(m_interpreter, SIGNAL(prog(QString,QString,uint,bool)), this, SLOT(handleProg(QString,QString,uint,bool)));
                                              connect(m_interpreter, SIGNAL(paramLoaded()), this, SLOT(handleLoadParams()));
                                              connect(m_interpreter, SIGNAL(paramChange()), this, SLOT(handleParamChange()));
                                              connect(m_interpreter, SIGNAL(version(ushort,ushort,ushort,QString,ushort,ushort,ushort)), this, SLOT(handleVersion(ushort,ushort,ushort,QString,ushort,ushort,ushort)));
                                              m_interpreter->start();
                                          }
                                          m_pixyConnected = true;
                                      }
                                      catch (std::runtime_error &exception)
                              ...
                              
                              Pablo J. RoginaP 1 Reply Last reply
                              0
                              • J jrod2much

                                @JKSH Alright so I read up on the subject and I think I understand. A null pointer does not point to an address so it can't be dereferenced. I also found this video that made me feel stupid.
                                https://www.youtube.com/watch?v=bLHL75H_VEM

                                Alright so what is my next step. Should I eliminate the two lines of code that make m_interpreter and m_renderer NULL? or do I have to point it to a specific address value?

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

                                @jrod2much said in Signals and slots or whatever:

                                A null pointer does not point to an address so it can't be dereferenced.

                                Correct.

                                I also found this video that made me feel stupid.
                                https://www.youtube.com/watch?v=bLHL75H_VEM

                                I think he's being a bit harsh ;-)

                                Should I eliminate the two lines of code that make m_interpreter and m_renderer NULL? or do I have to point it to a specific address value?

                                You must never ever use these:

                                • Null pointers
                                • Uninitialized pointers
                                • Dangling pointers

                                Remember, take some time to learn the foundations of C++. It will save you lots of pain and heartache in the future.

                                @jrod2much said in Signals and slots or whatever:

                                GUYS WE DID IT!!!!!!!!!!!!! ITS OUTPUTING THE VALUES!!!!

                                Congratulations! Happy coding.

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

                                1 Reply Last reply
                                4
                                • J jrod2much

                                  @JKSH @VRonin @jsulm @J-Hilk
                                  GUYS WE DID IT!!!!!!!!!!!!! ITS OUTPUTING THE VALUES!!!!
                                  0_1538646514714_02a43331-64d9-4717-990d-2c1101843a9f-image.png
                                  I searched the code for the whatever you call it when you make a new object and placed the connect function that @VRonin gave me there and BOOM

                                  ...
                                    }
                                                      dir = fd.directory().absolutePath();
                                                      m_settings->setValue("fw_dialog", QVariant(dir));
                                                  }
                                              }
                                              else if (m_interpreter==NULL)
                                              {
                                                  m_console->clear();
                                                  m_console->print("Pixy detected.\n");
                                  
                                                  m_interpreter = new Interpreter(m_console, m_video, &m_parameters, m_initScript);
                                  
                                                  connect(m_interpreter->m_renderer,&Renderer::Rvalues,m_ui->textBrowser,&QTextBrowser::setText); //Added
                                  
                                                  connect(m_interpreter, SIGNAL(error(QString)), this, SLOT(error(QString)));
                                                  connect(m_interpreter, SIGNAL(textOut(QString,uint)), this, SLOT(handleText(QString,uint)));
                                                  connect(m_interpreter, SIGNAL(runState(int,QString)), this, SLOT(handleRunState(int,QString)));
                                                  connect(m_interpreter, SIGNAL(finished()), this, SLOT(interpreterFinished())); // thread will send finished event when it exits
                                                  connect(m_interpreter, SIGNAL(connected(Device,bool)), this, SLOT(handleConnected(Device,bool)));
                                                  connect(m_interpreter, SIGNAL(actionScriptlet(QString,QStringList,bool)), this, SLOT(handleActionScriptlet(QString,QStringList,bool)));
                                                  connect(m_interpreter, SIGNAL(view(QString,uint,bool,bool)), this, SLOT(handleView(QString,uint,bool,bool)));
                                                  connect(m_interpreter, SIGNAL(prog(QString,QString,uint,bool)), this, SLOT(handleProg(QString,QString,uint,bool)));
                                                  connect(m_interpreter, SIGNAL(paramLoaded()), this, SLOT(handleLoadParams()));
                                                  connect(m_interpreter, SIGNAL(paramChange()), this, SLOT(handleParamChange()));
                                                  connect(m_interpreter, SIGNAL(version(ushort,ushort,ushort,QString,ushort,ushort,ushort)), this, SLOT(handleVersion(ushort,ushort,ushort,QString,ushort,ushort,ushort)));
                                                  m_interpreter->start();
                                              }
                                              m_pixyConnected = true;
                                          }
                                          catch (std::runtime_error &exception)
                                  ...
                                  
                                  Pablo J. RoginaP Offline
                                  Pablo J. RoginaP Offline
                                  Pablo J. Rogina
                                  wrote on last edited by
                                  #71

                                  @jrod2much glad you solved your issue. In appreciation to all the people that helped you with it, please don't forget to mark your post as solved!

                                  Upvote the answer(s) that helped you solve the issue
                                  Use "Topic Tools" button to mark your post as Solved
                                  Add screenshots via postimage.org
                                  Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

                                  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