如何访问'有效负载'连接语句中的信号是什么?
说信号如下:
signals:
void stateChanged(std::pair<unsigned, unsigned>);
现在在连接语句中,我想访问lambda中的std::pair
,我该怎么做?这样的事情:
connect(&sender, &sendClass::stateChanged, ()[]{ use content of std::pair for conversion here; emit other signal with converted content });
答案 0 :(得分:3)
你必须给你的lambda函数参数:
connect(&sender, &sendClass::stateChanged,
(std::pair<unsigned, unsigned> state)[] { /*do something with state*/ });