QConnect find no such slot on QCombobox by Qt Creater
- by user2534154
I create a window inherit from QWidget
I set grid layout to that Window
I make a function called handleHeroChange(int index) in public slot inside that window
I add a Qcombobox to call that function handleHeroChange(int index).
Qtcreator keep telling:
QObject::connect: No such slot QWidget::handleHeroChange(int) in ../Testing/Window.cpp:92
Why did i do wrong?
THE CODE:
Window::Window(QWidget *parent)
: QWidget(parent)
{
QGridLayout *grid = new QGridLayout(this);
QComboBox *comboHeroClass = new QComboBox();
comboHeroClass->addItem("Witcher");
comboHeroClass->addItem("Maurander");
comboHeroClass->setCurrentIndex(1);
grid->addWidget(comboHeroClass, 2,3,1,1);
QComboBox::connect(comboHeroClass, SIGNAL(currentIndexChanged(int)),this, SLOT(handleHeroChange(int)));
}
void Window::handleHeroChange(int index){
QPixmap myImage;
if(index == 0){
}else if(index == 1){
}
}