Qt 如何使用 lambda 表达式连接信号和槽?

connect(camera, static_cast<void(QCamera::*)(QCamera::LockStatus, QCamera::LockChangeReason)>(&QCamera::lockStatusChanged),
      [=](QCamera::LockStatus status, QCamera::LockChangeReason reason){ /* ... */ });


static_cast<void(QCamera::*)(QCamera::LockStatus, QCamera::LockChangeReason)>(&QCamera::lockStatusChanged)
上面这句是一个静态转换 static_cast<>()

QCamera::* 是类指针
QCamera::LockStatus 函数参数
QCamera::LockChangeReason 函数参数
&QCamera::lockStatusChanged 函数地址

 

posted @ 2019-04-11 21:12  findumars  Views(664)  Comments(0Edit  收藏  举报