ayanda83
17th January 2017, 19:00
Hi there guys, I am new to C++11 expressions. I got a lambda below and it crashes my program.
void Joburg_Page::connect_to_HTML_tags(bool ok)
{
QString docTitle;
this->runJavaScript("document.title"
"}", [&docTitle](const QVariant &data){docTitle = data.toString();});
qDebug() << docTitle <<endl;
}
}
Why is it necessary that I must declare docTitle is a member of the class before the above code works?
void Joburg_Page::connect_to_HTML_tags(bool ok)
{
QString docTitle;
this->runJavaScript("document.title"
"}", [&docTitle](const QVariant &data){docTitle = data.toString();});
qDebug() << docTitle <<endl;
}
}
Why is it necessary that I must declare docTitle is a member of the class before the above code works?