Call function by change index in combobox

  • Hi
    I want to call a function by changing Current index in my ComboBox

    I wrote this code :
    void publisher::on_cmb_subj_currentIndexChanged(const QString &arg1)

    but this is not work!!

  • Moderators

    What is the name of your combobox?

  • Personally, I prefer to connect my signals and slots explicitly. Did you connect yourself, or...? And you did connect yourself, what did the connect statement return?

  • hi
    my combobox name is cmb_subj

    i like to use connect signals and slots.
    how can i connect my cmb_subj signal (current index changed) and my slot call a function.


  • AFAIK, underscores result in problems with automatic signal-slot connection. One of the reasons I don't like that mechanism at all...

    Instead, just explicitly connect the signal to the slot in your constructor (just after the ui.setupUi(this); call), and it will work. If you need help with the syntax, refer to the [[doc:QObject]] documentation.

  • thanks Andre
    It's work

Log in to reply

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