Connect signal to signal



  • As the title says I want to connect signal to a signal but the compiler gives me this error:

    error: no matching function for call to '_Camera::connect(MarkFrame*&, const char*, _Camera*, const char*)'
          QObject::connect(markFrame,SIGNAL(logM(QString)),this,SIGNAL(Log(QString)));
    
    _Camera::_Camera(QString camera_name){
         this->camera_name = camera_name;
         markFrame = new MarkFrame;
         connect(&socket,SIGNAL(bytesWritten(qint64)),this,SLOT(bytesWrittenC(qint64)));
         QObject::connect(markFrame,SIGNAL(logM(QString)),this,SIGNAL(Log(QString)));
     }
    

    What could be the problem?


  • Qt Champions 2016

    Is
    Log(QString)
    placed in the signal section ?
    Also clean build folder and re-run qmake and then rebuild all just to be sure.



  • @mandruk1331 To add to @mrjj is MarkFrame derived from QOjbect and contains the Q_OBJECT macro?



  • @mandruk1331

    First you make sure that both the source and destination objects are derived from QObject and as @ambershark said, add Q_OBJECT macro and in connect statement QObject:: is not required because you are already in QObject context only.
    If you go through all the above cases, it should works.



  • @mandruk1331 Iirc the old syntax does not support signal to signal connections, you should use the new one, that way it works for sure.

    connect(markFrame,&MarkFrame::logM ,this,&_Camera::Log);
    

  • Qt Champions 2016

    @J.Hilk
    old syntax does do signal to signal or i really have a vivid imagination as i use
    signal to signal to interface to widgets from dialogs. :)



  • @mrjj I just reread the docs and turns out my memory is treasonous thing these last few days...


  • Qt Champions 2016

    @J.Hilk
    Its due to summer. Brain thinks on other types on 'connections' ;)
    alt text


Log in to reply