qt creator 信号 槽 lambda 表达式
https://www.bilibili.com/video/BV1XW411x7NU?p=14
QPushButton *b4 = new QPushButton(this);
b4->setText("Lambda表达式");
b4->move(150,150);
int a=10, b=100 ;
测试1:
// connect(b4,&QPushButton::released,
// [b4 ,a,b]()
// {
// b4->setText("123");
// qDebug() << "1111" <<a<<b;
// }
// );
// connect(b4,&QPushButton::released,
// [=]() mutable
// {
// b4->setText("123");
// qDebug() << "1111" <<a<<b;
// a = 11 ;
// }
// );
connect(b4,&QPushButton::clicked,
[=](bool isCheck) mutable
{
b4->setText("123");
qDebug() << "1111" <<a<<b;
a = 11 ;
qDebug() <<isCheck ;
}
);