,我打算给QDoubleSpinBox信号连接到C++ 11 LAMDA:信号连接到C++ 11个lambda表达式在QT5
QObject::connect(sbox_roughness, &QDoubleSpinBox::valueChanged,
[=]() { std::cout << "value changed" << std::endl; });
这是给我:
error: no matching function for call to ‘Game::connect(QDoubleSpinBox*&, <unresolved overloaded function type>, Game::initGui()::<lambda()>)’
[=]() { std::cout << "value changed" << std::endl; });
note: no known conversion for argument 2 from ‘<unresolved overloaded function type>’ to ‘const char*’
我已经试图this:
QObject::connect(sbox_roughness, static_cast<void (QDoubleSpinBox::*)(int)>(
&QDoubleSpinBox::valueChanged),
[=]() { std::cout << "value changed" << std::endl; });
给我:
我在这里错过了什么?
因为它不起作用:(QDoubleSpinBox :: *)(** int **)>(&QDoubleSpinBox :: valueChanged)。对不起,监督这个!好答案! –