PDA

View Full Version : currentTextChanged ComboBox



luca_
1st February 2018, 18:03
Hi, I have to change label text when I change combobox value. I used this method

void MainWindow::on_cb_regioni_currentIndexChanged(cons t QString &arg1)
{
ui->lb_regione->setText(arg1);
}

When I change the combobox nothing happens.
I tried to debug it, but this method is never called.

Thanks everybody.

d_stranz
1st February 2018, 22:13
It looks like you are trying to use Qt MOC's automatic connection feature. This will not work if you do not spell the name of the widget exactly the same in your code and in Qt Designer (the .ui file).

It also will not work if the combobox is not a child of your QMainWindow class (that is, if you make a separate QWidget-based class as the "central widget" with its own .ui file where the combobox is actually defined).