[SOLVED] Signal & slots, need another pair of eyes on this



  • Hi,

    I need another pair of eyes to help me look at this error code:

    QObject::connect: No such slot RadioUserWindow::getrsnridsignal(QString,int) in ....\radiouser_config_rsn_rid.cpp:43
    QObject::connect: (sender name: 'radiouser_config_rsn_rid')
    QObject::connect: (receiver name: 'RadioUserWindow')
    col1 is "CU$9"
    col2 is 9
    emit signal from rsnrid

    I have this form "radiouser_config_rsn_rid" which is being called by "RadioUserWindow". radiouser_config_rsn_rid will perform a query search in the database and displays the results in a table.User may then select a row on the table and click OK, which then radiouser_config_rsn_rid will send the data values to the parent RadioUserWindow lineedit ui.

    Here's how i code it:

    radiouser_config_rsn_rid.cpp:
    @
    connect(this,SIGNAL(rsnridsignal(QString,int)),parentWidget(),SLOT(getrsnridsignal(QString,int)));

    void radiouser_config_rsn_rid::on_pushButton_3_clicked() //this is the OK button
    {
    QModelIndex idx = ui->tableView->currentIndex();
    col1 = rsnrid_list->item(idx.row(),0)->text();
    col2 = rsnrid_list->item(idx.row(),1)->text().toInt();
    qDebug() << "col1 is" << col1 ; //the values can be displayed correctly
    qDebug() << "col2 is" << col2 ;
    emit rsnridsignal(col1,col2);
    qDebug() << "emit signal from rsnrid" ;
    this->close();
    }
    @

    in RadioUserWindow.cpp:
    @
    void RadioUserWindow::getrsnridsignal(QString rsn, int rid)
    {
    qDebug() << "signal received";
    rsn = col1;
    rid = col2;
    ui->lineEdit_14->text() = rsn;
    ui->lineEdit_15->text() = rid;
    }

    @

    Can someone pinpoint where is wrong please? Thank you!


  • Moderators

    Hi,

    Please post RadioUserWindow.h also.



  • Hi,
    RadioUserWindow.h contains this line

    void getrsnridsignal(QString, into rid);


  • Moderators

    [quote author="sharon_obl82" date="1412674198"]Hi,
    RadioUserWindow.h contains this line

    void getrsnridsignal(QString, into rid);[/quote]Is it a slot?

    Please post the whole header.



  • signals:
    void getrsnridsignal(QString, into rid);


  • Moderators

    getrsnridsignal(QString, into rid) is supposed to be a slot and not a signal.



  • oh dear.. you're right!
    Thank you very much! it works! :)



  • Hi
    if your problem is solved please add [SOLVED] before thread title.
    so other members can notify that problem has been solved.


  • Lifetime Qt Champion

    Hi,

    On a side note, it's legal to connect a signal to another signal (it's signal forwarding), just change the macro.

    But in any case, you should change the name of your signals and slots to something more meaningful, it will avoid such confusion ;)


Log in to reply
 

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