我正在尝试在插槽中发送两个参数,但是出现以下错误。
'layoutProperty'无法隐式捕获,因为未指定默认捕获模式
'layoutProperty'是QVBoxLayout。
void Container::CreatePositionAnimationUI(QHBoxLayout *layout1 ,
QHBoxLayout *layout2 , QHBoxLayout *layout3 , QVBoxLayout
*layoutProperty )
{
QPushButton *pushButtonKey1 = new QPushButton;
QPushButton *pushButtonKey2 = new QPushButton;
QPushButton *pushButtonKey3 = new QPushButton;
layout1->addWidget(pushButtonKey1);
layout2->addWidget(pushButtonKey2);
layout3->addWidget(pushButtonKey3);
QObject::connect(pushButtonKey1, &QPushButton::clicked , this,
[this] {SetPositionKeyGUIParameters(1 ,layoutProperty); }); // Get error on this line
}
答案 0 :(得分:0)
尝试一下
QObject::connect(pushButtonKey1, &QPushButton::clicked , this, [&]
{SetPositionKeyGUIParameters(1 , layoutProperty); });