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)
{
this->runJavaScript("document.title"
"}",
[&docTitle
](const QVariant &data
){docTitle
= data.
toString();
});
qDebug() << docTitle <<endl;
}
}
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;
}
}
To copy to clipboard, switch view to plain text mode
Why is it necessary that I must declare docTitle is a member of the class before the above code works?
Bookmarks