QMetaObject::connectSlotsByName: No matching signal



  • Hi ,
    I m using Qt5.11.1

    My application is running fine for all the time and no error/warnings.But when I configure the Gateway and Local IP for ethernet from Rpi3 to my Device.I m having the below issue and my app in not opening at all.
    Please suggest on the same.

    QMetaObject::connectSlotsByName: No matching signal for on_pushButton_2_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_counterDataStreaming_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_adcDataStreaming_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_stopDataStreaming_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_checkBox_clicked(bool)
    QMetaObject::connectSlotsByName: No matching signal for on_checkBox_2_clicked(bool)
    QMetaObject::connectSlotsByName: No matching signal for on_pushButton_5_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_pushButton_6_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_pushButton_7_clicked()
    QMetaObject::connectSlotsByName: No matching signal for on_Chekck_Connection_Timer()
    CUSTOMER_MODE
    QObject::connect: No such signal QUdpSocket::stateChanged(QAbstractSocket::SocketError)
    QObject::connect: (receiver name: 'MainWindow')


  • Moderators

    @shivaVMC Can you post your connect(...) where you connect QUdpSocket::stateChanged to a slot in your MainWindow?
    And actually you can post all connects for all the signals you posted.



  • void MainWindow::on_counterDataStreaming_clicked()
    {
    QByteArray byArrSendPkt;
    CProtocol objProtocol;
    QHostAddress hostIp;
    hostIp.setAddress("13.13.13.13");//10.0.0.178
    objProtocol.mPktCmdWrite(STREAMINGSTRAT, STREAMINGREG, STREAMINGCOUNTER, byArrSendPkt);
    m_SockUdp_ReagWrt.writeDatagram(byArrSendPkt,hostIp,60012);
    }

    void MainWindow::on_adcDataStreaming_clicked()
    {
    QByteArray byArrSendPkt;
    CProtocol objProtocol;
    QHostAddress hostIp;
    hostIp.setAddress("13.13.13.13");//10.0.0.178
    objProtocol.mPktCmdWrite(STREAMINGSTRAT, STREAMINGREG, STREAMINGADCDATA, byArrSendPkt);
    m_SockUdp_ReagWrt.writeDatagram(byArrSendPkt,hostIp,60012);
    }

    void MainWindow::on_stopDataStreaming_clicked()
    {
    QByteArray byArrSendPkt;
    CProtocol objProtocol;
    QHostAddress hostIp;
    hostIp.setAddress("13.13.13.13");//10.0.0.178
    objProtocol.mPktCmdWrite(STREAMINGSTOP, STREAMINGREG, STREAMINGSTOPDATA, byArrSendPkt);
    m_SockUdp_ReagWrt.writeDatagram(byArrSendPkt,hostIp,60012);
    }
    connect(checK_ConnectionStatus,SIGNAL(timeout()),this,SLOT(on_Chekck_Connection_Timer()));

    connect(&m_sockUdp, SIGNAL(stateChanged(QAbstractSocket::SocketError)),this,SLOT(mSltOnTCPStateChanged(QAbstractSocket::SocketState)));


  • Moderators

    @shivaVMC Please take a look at the documentation: http://doc.qt.io/qt-5/qabstractsocket.html#stateChanged



  • Hi,
    I couldn't find anything that helps me to fix my bug,can you please suggest me on this


  • Qt Champions 2017

    @shivaVMC

    Quoting the documentation provided by @jsulm:

    QAbstractSocket::SocketState is not a registered metatype, so for queued connections, you will have to register it with Q_DECLARE_METATYPE() and qRegisterMetaType().


  • Moderators

    @shivaVMC stateChanged signal has a different parameter than the one your using:

    connect(&m_sockUdp, SIGNAL(stateChanged(QAbstractSocket::SocketError)),this,SLOT(mSltOnTCPStateChanged(QAbstractSocket::SocketState)));
    

    Look once more.



  • @aha_1980
    Itis registered as below

    qRegisterMetaType< QAbstractSocket::SocketState >();


  • Moderators

    @shivaVMC You don't need to register anything as you're not using queued connection. Simply use the correct parameter type for the signal...


  • Qt Champions 2017

    @jsulm said in QMetaObject::connectSlotsByName: No matching signal:

    @shivaVMC You don't need to register anything as you're not using queued connection. Simply use the correct parameter type for the signal...

    Oh, missed that...



  • I m not able to fix it....I need your support

    connect(&m_sockUdp,SIGNAL(readyRead()),this,SLOT(mSltOnTCPDataReceivedFromClient()));
    connect(ui->btnConnect,SIGNAL(clicked()),this,SLOT(mSltOnBtnConnectClick()));

    connect(&m_sockUdp, SIGNAL(stateChanged(QAbstractSocket::SocketError)),this,SLOT(mSltOnTCPStateChanged(QAbstractSocket::SocketState)));
    

    Above 3 statement of code are contiguous in my function,at 3rd connect statement I m faccing issue ...
    In SIGNAL stateChanged what will be the correct parameter?


  • Moderators

    @shivaVMC
    "In SIGNAL stateChanged what will be the correct parameter?" - why don't you read the documentation? I even posted a link to it here.

    connect(&m_sockUdp, SIGNAL(stateChanged(QAbstractSocket::SocketState)),this,SLOT(mSltOnTCPStateChanged(QAbstractSocket::SocketState)));
    


  • @jsulm
    Sorry,later I have realized and replace SocketError with SocketState.

    Currenlty I have someother issue now..I m having a look on it.

    Thanks For the support.Get back you soon on the same



  • Hi,
    I m not able to enter into "if" condition(first if condition),can you please suggest on the below code where I m going wrong.

    bjProtocol.mPktRegRead(a_nAddress,byArrSendPkt); //Its entering into this   mPktRegRead funtion and return value is fine
    qDebug()<<"Send Pkt count ===="<<byArrSendPkt.count(); //this  debug is also okay
    

    can you please help on this below lines where I m doing wrong

        m_SockUdp_ReagWrt.writeDatagram(byArrSendPkt,hostIp,60014);                                                                            
        if(m_sockUdpRegRd.waitForReadyRead(SOCKET_CMND_TIMEOUT_IN_MSEC)){  
            if( m_sockUdpRegRd.hasPendingDatagrams() ) {
    //statements
                }
    //statemnets
    }
    

  • Moderators

    @shivaVMC said in QMetaObject::connectSlotsByName: No matching signal:

    if( m_sockUdpRegRd.hasPendingDatagrams()

    Why do you need this if? After waitForReadyRead() you know that there is something to read.


  • Qt Champions 2017

    @shivaVMC

    please don't use waitForReadyRead, use the readyRead signal instead!

    You are blocking the event loop here and it's likely that your app is not working as expected.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.