Connect QML signal to C++11 lambda slot (Qt 5)
问题 Connecting a QML signal to a regular C++ slot is easy: // QML Rectangle { signal foo(); } // C++ old-style QObject::connect(some_qml_container, SIGNAL(foo()), some_qobject, SLOT(fooSlot()); // works! However, no matter what I try, I cannot seem to be able to connect to a C++11 lambda function slot. // C++11 QObject::connect(some_qml_container, SIGNAL(foo()), [=]() { /* response */ }); // fails... QObject::connect(some_qml_container, "foo()", [=]() { /* response */ }); // fails... Both