for(i=0; i<height; i++)
{
for(j=0; j<width; j++)
{
button[i][j] = new QPushButton("Empty", this);
button[i][j]->resize(40, 40);
button[i][j]->move(40*j, 40*i);
connect(button[i][j], SIGNAL(clicked()), this, SLOT(changeText(button[i][j])));
}
}
如果我用函数(例如fullScreen)更改函数changeText,它可以工作,但是当我使用我定义的插槽(changeText)时出现此错误,我不知道如何解决它
QObject::connect: No such slot buttons::changeText(&button[i][j])
这是函数changeText:
void buttons::changeText(QPushButton* button)
{
button->setText("Fish");
}
注意:在头文件中我定义了这样的插槽:
类按钮:公共 QWidget
Q_OBJECT
public slots:
void changeText(QPushButton* button);