I'm trying to connect a button to a function, so when I push the button, the function gets called with a specific parameter. I have
class FieldGridWidget : public QWidget
{
Q_OBJECT
public:
FieldGridWidget(QWidget *parent=0);
~FieldGridWidget();
public slots:
void resizeGrid(int n);
private:
QGridLayout* _gridLayout;
QVector<QPushButton*> _buttonGrid;
};
then the button
_button3 = new QPushButton("3x3", this);
and I'm trying to connect it so if clicked, the resizeGrid
function gets called with the parameter 3. For this, I'm trying
connect(_button3, SIGNAL(clicked()), _fieldGrid, SLOT(resizeGrid(3))); //this is line 21
but I get the runtime error
QObject::connect: No such slot FieldGridWidget::resizeGrid(3) in ../filename.cpp:21
What am I doing wrong? Or how can I make it so if I press the button, resizeGrid(3)
gets called?
Thank you!