I'm designed a QTableWidget
with QPushButton
, I would like to connect these buttons with a slot to hide some rows.
I'm using a lambda expression to pass a number of a row. But the compiler doesn't recognized this expression :
connect(this->ui->tableWidget->cellWidget(i,0),&QPushButton::clicked,[this,i]{hideRows(i);});
I have this error:
error: no matching function for call to 'SoftwareUdpater::MainWidget::connect(QWidget*, void (QAbstractButton::*)(bool), SoftwareUdpater::MainWidget::displayTable()::<lambda(int)>)'
- The function
hideRows(int)
is declared as a function. And, as a slot, it doesn't work, CONFIG += c++11
is added in pro file,- My class
MainWidget
inherits fromQWidget
, Q_OBJECT
is added in the header.
So I don't udnerstand why connect()
is not recognized by Qt 5.9.1 MinGw 32bit.
Edit: [this,i]()
instead of [this](const int i)
for the lambda expression