Qt World Summit: Submit your Presentation

Signal Not Found for QComboBox

  • i cant seem to figure out why, but i keep getting this error

    QObject::connect: No such signal QComboBox::currentIndexChanged(const QString & text) in mainwidgets.cpp:251
    QObject::connect:  (sender name:   'charactersBox')
    QObject::connect:  (receiver name: 'CharacterViewSettings')

    i am connecting the signal with this line of code

    connect(charactersBox, SIGNAL(currentIndexChanged(const QString & text)), this, SLOT(characterSelectedChange(const QString & text)));

    and i am declaring the QComboBox with this line of code

    charactersBox = findChild<QComboBox*>("charactersBox");

    the child is just a QComboBox in my .ui file with nothing special about it, also named appropriately. All the other widgets in my .ui have no problem connecting signals, its just this combo box, which also wont work with any of its signals all giving the same error

  • Lifetime Qt Champion

    @SolaVitae Remove parameter names from connect and try again:

    connect(charactersBox, SIGNAL(currentIndexChanged(QString)), this, SLOT(characterSelectedChange(QString)));

  • Hi @SolaVitae , as suggested by @jsulm you have to delete param name in connect signal,

    you can keep const &

    Your connect will be then:

    connect(charactersBox, SIGNAL(currentIndexChanged(const QString &)), this, SLOT(characterSelectedChange(const QString &)));

Log in to reply