报错内容:
问题描述:
这是由于QComboBox中的currentIndexChanged信号重载导致:
解决方式:
QT5新版的信号槽语法,进行强制类型转换:
connect(ui->comboBox,static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged),this,&Widget::onCurrentIndexChanged);
connect(ui->comboBox,static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged),this,&Widget::onCurrentStringChanged);
旧版的信号槽语法。则:
connect(ui->comboBox,SIGNAL(currentIndexChanged(int)),this,SLOT(onCurrentIndexChanged(int)));
connect(ui->comboBox,SIGNAL(currentIndexChanged(QString)),this,SLOT(onCurrentStringChanged(QString)))