Hi,

I want to get data returned by Javascript into QT variable. Javascript is getting called successfully and also able to print output using qDebug(). However, I want to process the output and hence needs to be stored in one variable. But it is giving error either no viable overload '=' or variable 'v_data' cannot be implicitly captured in a lambda with no capture-default specified

I have below code
Qt Code:
  1. QString CodeMirror::text() const
  2. {
  3. QString v_data;
  4. page()->runJavaScript("editor.getValue()",[this](const QVariant &v){
  5. v_data = v.toString();
  6. });
  7. return v_data;
  8. }
To copy to clipboard, switch view to plain text mode 

Please help me to resolve the same

Cheers

Screenshot 2020-10-26 at 3.28.30 PM.jpg