Important: Please read the Qt Code of Conduct -

No matching signal for ...[SOLVED]

  • in the mainwindow constructor:
    @ connect( ui->projectsTabWidget,SIGNAL(tabCloseRequested(int)),this,SLOT(on_close_tab(int)));

    in the mainwindow header file:
    @void on_close_tab(int);@

    in the mainwindow .cpp
    @void MainWindow::on_close_tab(int i)
    qDebug()<<"close requested....";

    the thing is it works fine,whenever the data changes, the slot excutes,but i still get this :
    QMetaObject::connectSlotsByName: No matching signal for on_close_tab(int)
    and i'm just wondering why ,or maybe i'm doing it wrong

  • Lifetime Qt Champion


    Somewhere there's a call to "connectSlotsByName": and your slot doesn't follow the signature style to be used with connectSlotsByName

  • hi
    the thing is my code doesn't contain this function at all "connectSlotsByName" ,and i never used such a function,
    maybe "connect" is calling it or the IDE is calling it somewhere else
    but the code is running fine,so is there anything i should be concerned about

  • AFAIK connectSlotsByName is probably introduced through moc.

    I am using in one of my applications the feature, but do not call connectSlotsByName IIRC.

    It could be triggered in your case by the name of the slot (presumably "on_" starts are the triggers). Change the slot to something else and see, if the warning disappears.

  • hi thanks for your replies
    @koahing,yes when i delete "on_" the warnning disapears

  • @karim24 thanks for the topic! It helps me as well. I removed the on_* from the beggining of the signals and slots names and the warnings disappear. Cheers.

Log in to reply